Style and Theme cleanup

Styles and themes as is are very powerful, but they could use some additions to them.

For example, it would be nice to be able to automagically set a specific theme to an object, regardless of object type. I am thinking something like lv_obj_set_theme, or wherever. This would then set the selected theme to all of the subthemes of an object.

Lets say you want to use LV_THEME_PRETTY_COLOR on everything, you currently have to go an set it over and over for each of the objects you create. It would be nice to:
A) Have a way to set the default theme for all new objects
B) Reset the theme once, and all subthemes get set as well.

I realize this wont work for some things (Like something that has a built in inactive and active theme, if they were both set to the same thing, you would not be able to visually see the difference).

This is really a “Thinking out loud exercise” to get peoples opinions and thoughts, I think there is room for improvement here, and the current code is a really good start.

There is a way!
lv_theme_set_current(lv_theme_material_init(120, NULL));
If you call it all object created after that will use the set theme.

I don’t really understand this. What is a subtheme?

1 Like

Sorry. I was mixing metaphors.

What I meant was a way to set the default style for all objects.

Also it would be nice to be able to set all the styles for an object with one call, for example to set everything for say a lv_win to lv_style_pretty_color

Does it really make sense to set all the same style for everything? E.g. a slider will have a background and indicator+knob with the same color.

I suppose that is a good point, I need to rethink this a bit. I have some desires to make styles and themes more user friendly, I just have not figured out the all important “How”

1 Like