StablexUI
StablexUI copied to clipboard
Enhancement: Variables
Would be nice to have some kind of variables, say like SASS (http://sass-lang.com/#variables) so you don't have for example some main color all over xml files.
You can use "defaults" like here: https://github.com/RealyUniqueName/StablexUI/blob/master/samples/defaults/Main.hx
Or create class constant
static public var COLOR = 0x00FFFF
And use it in xml:
<Button skin:Paint-color="$Main.COLOR"/>
I am using both at the moment, but was thinking about more xml-centric solution, something along the lines:
variables.xml
<?xml version="1.0" encoding="UTF-8"?>
comming from the code so can be programmaticaly scaled
<meta:variable name="def_font_size" value="$UI.DEF_FONT_SIZE" />
graphic guy can define new ones and fiddle with them
<meta:variable name="color_active" value="0x00FF00" />
<meta:variable name="color_passive" value="0x0000FF" />
and then at the top of any other xml file (defaults, ...) just
<meta:include src="variables.xml" />
and have those variables defined.
Thanks for your thoughts and the great job you have done creating this lib.
That's a good idea! I'll add it to my TODO :)