Change Skin (style) at Runtime

I would like to have different skins for my ui, which a user can change.
I’m thinking of ways to do this.

I’m thinking of having different styles in my xml file,

<style id=styleA>
//...
</style>
<style id=styleB>
//......
</style>

and choosing one via code in my MainView.hx file.
How would I call a particular style, in this way?
Is this the best way to go about it?

Since you’ve been posting a lot about HaxeUI recently, I assume that this question is about that. However, please consider mentioning that you’re using HaxeUI every time that you start a new thread about it. There are other UI frameworks for Haxe too, so it’s good to be clear about which one you are using, for folks who may not have been following along closely.

1 Like

I’m using haxeui-core 1.5.0, and that’s what I have been posting a lot about… for those who have not been following along closely.

I agree with josh, maybe prefix with “[haxeui]”? Dunno, anyway, the answer to the question is to create a theme, or, if you want to do it manually, and ad hoc, clear and reload the style sheets, something like:

Toolkit.styleSheet.parse("some more css");

Enjoy! :slight_smile:

I suppose you mean, something like this. Thanks.

Indeed, something like that would work. Keep in mind though that, really, a “theme” (in haxeui) is really just a word for a collection of styles and resources, so you could certainly restyle everything “on the fly” :slight_smile:

1 Like