Moving to v7 before official release


What MCU/Processor/Board and compiler are you using?

LPC17xx, ESP32, …

What do you want to achieve?

Continue LvGL usage with the version 7 to get rid of the v6.x styles system :upside_down_face:

What have you tried so far?

Switched to branch “dev-7.0” --> basic functionality is OK

Code to reproduce

So - is there any quick “crash course” on using version 7? What I’m missing is how to get started with the new styles system, otherwise it seems to be much alike v6.x (except for animations :slight_smile:)

I saw there are some commits on the “docs” repo, is there a way to see those locally?

Of course the hard way exists: wade through the source…


There are some basic examples about halfway through the initial teaser post.

1 Like

Thank you Sir,

indeed, there is something about styles… Now I should just try to digest those (easier said than done).

One particular point: there used to be a global style definition “lv_style_scr”, from which all the other styles inherited. If I changed that (or other related built-in styles) right after calling “lv_init()”, it was easy to define some stuff globally, e.g. background colour(s). Is there anything similar in v7? My 20 min. source browsing session on this didn’t prove very fruitful.

I tried:

lv_obj_t *scr = lv_scr_act();

lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_radius(&style, LV_STATE_DEFAULT, 0);
lv_style_set_border_width(&style, LV_STATE_DEFAULT, 0);

lv_obj_add_style(scr, LV_OBJ_PART_MAIN, &style);

–> The screen background got black, but a newly created button had red, round border. Any ideas please?


I’m still updating the docs so we don’t have ready to use guide at this moment.
However the widgets and style parts are already written but will be still reviewed. (As I know myself it’s full of typos :sweat_smile: )

I’ve uploaded it here:

To answer your question about the background color: The background color property is not inherited so you can’t set a color for the screen and expect to see it in the children.
What you can do is to customize the theme you use or create your own theme. (The styles from the theme are applied to the object when they are created)


Thank you!

I had a quick glimpse on the docs, they seem to answer many questions which have raised during my short trial-and-error testing of V7.

I already copied the “theme_material”, moved it out of the lvgl “official” directory to keep the tree intact and made the changes there. This was also quite much trial-and-error (“oh, now it doesn’t find this and that include!”) but I managed to get it working. Now, how to use the new theme/style system, I think the docs you provided will get me going. To the correct direction, I hope :slight_smile:

Again, many thanks!

Great! Let us know if something is unclear!

1 Like

Hello, I’m new to LittlevGL too, so I’m wondering if I should start with v7 already.
I will also be using ESP32, so the port project is not working at this moment.
At this moment I cannot build it. Can I open a new thread to get some help on during this transition?
Or do you prefer to use github issues?

One little thing on applying V7-style … well, styles.

#if 1
	lv_style_set_border_color(&style_item_cont, LV_STATE_DEFAULT, LV_COLOR_GREEN);
	lv_style_set_border_color(&style_item_cont, LV_STATE_PRESSED, LV_COLOR_GREEN);
	lv_style_set_border_color(&style_item_cont, LV_STATE_FOCUSED, LV_COLOR_GREEN);
	lv_style_set_border_color(&style_item_cont, LV_STATE_DEFAULT | LV_STATE_PRESSED | LV_STATE_FOCUSED, LV_COLOR_GREEN);
#endif // 0

Here, the desired states are bitfields - but against how one might think, it seems that I cannot agregate those. I.e, the latter option where the states are ORed, only “FOCUSED” state becomes valid (gets the green colour). Is there something obvious I don’t get - or is it just designed to behave like that?

I followed a little the preprocessor art creating those “lv_style_get/set*” macros, but … well, you know :smiley:

Thank you!

Yes, dev-7.0 is considered stable enough to make experiments with it.

@Carlos_Diaz can we open an issue in the esp repository to discuss the migration to v7?

Sure, done:

Can you add in a comment what else can be necessary?

You want to keep supporting v6 and v7 on the repo?

I think the easiest thing to do is make a release of the repo as is (zip it so the users can download it) and then port everything to v7, I don’t know if it’s possible to have two branches in a repo and each branch point to different submodule commits.


It means that when the object is in pressed and focused at same time then it will be green.

If you want the object to have green color in every state, just set that color in the default state.

This part of the docs should explain it. I’ve added some notes to Style docs but let me know if it’s still unclear.