How To Enable Dark Theme in SDL Demo?


I’m trying to enable the dark theme in the SDL/PC/Simulator Demo to no avail. Should this be possible “out of the box” (only changing the relevant define to 1), or is there more to be done to accomplish this?

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

N/A - SDL simulator; using make within the VSCode project.

What LVGL version are you using?

v8.0.0 (commit c597d25)

What do you want to achieve?

Enable dark theme for the SDL Demo.

What have you tried so far?

Changed #define LV_THEME_DEFAULT_DARK 0 to #define LV_THEME_DEFAULT_DARK 1. Also copied lv_conf.h to /ui/simulator/inc/ with no change. Using the preprocessor suggestion here, it appears to be defined properly (based on lv_conf.h), but I see no change in the demo app. Should the dark theme be usable in the demo?

Code to reproduce

Check out the demo project linked above (commit 10101817), change #define LV_THEME_DEFAULT_DARK 0 in lv_conf.h to #define LV_THEME_DEFAULT_DARK 1 then compile/debug.

Just call these after you have create a display:

  lv_theme_t * th = lv_theme_default_init(lv_disp_get_default(), lv_color_hex(0xff0000), lv_color_hex(0x00ff00), true, LV_FONT_DEFAULT);
  lv_disp_set_theme(lv_disp_get_default(), th);

Great, thanks! Turns out, I wasn’t cleaning the build directory (for a clean build) when I thought I was… whoops. Thanks for the input, though.