thi-ng / umbrella

⛱ Broadly scoped ecosystem & mono-repository of 199 TypeScript projects (and ~180 examples) for general purpose, functional, data driven development
https://thi.ng
Apache License 2.0
3.35k stars 149 forks source link

[imgui] additional theme options #119

Open postspectacular opened 5 years ago

postspectacular commented 5 years ago

The current theme system of @thi.ng/imgui is quite limiting. I'd like to hear from people which additional options might be useful - a wishlist of sorts.

When proposing additions, please also think how realistic it is that these might be easily achievable in WebGL (e.g. gradients, thick borders, rounded rects etc.). For some of these it might be best to provide some pre-rendering functionality and a new set of components working exclusively with texture atlases (or SDF-based shapes/shaders), instead of generating complex webgl geometry, requiring expensive tessellation...

postspectacular commented 5 years ago

Some initial list:

nkint commented 5 years ago

Hi! I still haven't played with imgui package a lot so I'm not completely aware of all the options

component specific config

I'm totally ok on avoid adding component specific config to GUITheme.

My idea is to use a set of color variations. I'm thinking of accent-# or primary- or secondary- color names (for example in material.io palettes ). Does it make sense?

postspectacular commented 5 years ago

@nkint instead of adding these variations to the theme directly, a simpler way would be defining them as derived themes and then just pushing/popping them on/off the theme stack:

const MY_THEME = { bg: "red", fg: "white", ... };
const MY_THEME_PRIMARY = { bg: "yellow", fg: "black", ... };
const MY_THEME_SECONDARY = { bg: "cyan", fg: "blue", ... };

Since beginTheme() & withTheme() only require partial themes and merge those with the existing top-most theme on the stack, these primary/secondary variations can be very minimal.

This approach would also not tie everything to this fixed setup of accent/primary/secondary...