What's the preferred way to achieve a customized theme?


I find myself needing to create a custom theme for my application, and I’m unsure about what would be the most idiomatic way to do so. I’ve successfully created a theme from scratch and applied it by simply calling lv_theme_set_act, but perhaps selecting the empty theme as default and extending it (as explained here) would be considered more appropriate? I’m looking for a purely stylistic suggestion.

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

SDL simulator/ESP32 with ESP-IDF

What LVGL version are you using?


Your current approach is better as the empty theme adds one blank style (i.e. nothing). Extending it would be a waste of CPU cycles and flash. :wink:

However, you could save a tiny bit more memory by entirely replacing the default theme selection in lv_conf.h with your theme.

1 Like

Thanks, the clarification is much appreciated :slight_smile:

Unfortunately working with ESP-IDF makes it a little hard to implement a default theme to be linked statically to the LVGL component for reasons that are not worth exploring here. I’m still in the process of experimenting to find out what is the best solution.