Replies: 2 comments 3 replies
-
I was thinking of how graphical toolkits like gtk and qt do for themeing. There are things like base16 too so could we apply some of those concepts here? Maybe we could extend As for custom nodes and custom themes we could just extend the Themes again, so if you have |
Beta Was this translation helpful? Give feedback.
-
I've got a workaround with a script: @tool
class_name ThemePropagated extends Theme
@export var text_color: Color:
set(value):
text_color = value
set_color("text_color", "Button", value)
set_color("text_color", "Label", value) With this theme, you can set only one value (text_color) and have it propagate to all the nodes you need. Understandly doing this for every single control with a text_color is way too much effort to be a "simple" workaround but is this worth putting in core (with a good coverage for similar settings) or more fitting for an addon? (Or maybe this isn't even what you wanted?) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When creating and theming interfaces, especially when using lots of StyleboxFlat for a more modern look for non game applications, there will be a lot of colors, but not many unique ones. That's where a small palette comes in handy.
This palette usually has just a few colors you want to use everywhere - but in themes you have to drag your hex codes through everything, manually. Of course you can use the swatches and recent colors to help set them, that is nice.
The issue arises if you want to either change or offer a secondary palette. Now what. Duplicate the theme and change everything by hand? Programmatically access each font-, stylebox background-, border-, and colorrect color to have quicker access to it in the future? Both very painful and time consuming. Might be easier to use a color swap shader. if the antialiasing wouldn't be weird with it. That's why i dropped the idea of interface theming.
Now, coming from scss, where everything can be a variable, it would be nice to be able to create something like "design tokens" or named values. For example:
Which would then be usable in other theme properties, instead of setting the raw value. When the value of a token changes, all theme properties referencing it would change with it.
My main interest would be colors here, but of course this can also extend to other things like fonts, textures, sizes (which would make other design systems easier, like defining large, medium and small sizes for spacing to be used in margincontainers or stylebox contentmargins).
While you can somewhat already do something like this with entire styleboxes by copying a singular stylebox and not making it unique, it's quite awkward to use. And you can't swap it out for a different stylebox everywhere (like flat to texture).
Slightly more usable: for textures you could get hacky and reference one AtlasTexture and then swap out the atlas texture resource, instead of using the texture directly. And similarly for fonts you could use a font variation as reference and swap out the base font, instead of using the font directly.
None of these hacks work for colors (or sizes) though.
Now, thinking about how this could elegantly fit into the rest of the theme system is a little challenging. We'd essentially need to have two "modes" for each theme property, either being the normal raw value, like it is now, or a string (which also isn't nice, some reference would be better). Interface-wise that would probably need an extra toggle on all the theme inputs. Little strange. Or maybe it's toggled through a right click context menu, but that makes the feature pretty hidden.
Maybe there are more elegant ways to do this - let us know if you think of one :)
Beta Was this translation helpful? Give feedback.
All reactions