StablexUI icon indicating copy to clipboard operation
StablexUI copied to clipboard

Enhancement: Variables

Open musanek opened this issue 11 years ago • 3 comments

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.

musanek avatar May 24 '13 21:05 musanek

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"/>

RealyUniqueName avatar May 25 '13 06:05 RealyUniqueName

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.

musanek avatar May 25 '13 09:05 musanek

That's a good idea! I'll add it to my TODO :)

RealyUniqueName avatar May 25 '13 10:05 RealyUniqueName