want to change default_theme light to dark in progress running.
example: project start with theme light, but sometime, i want to change dark, and change light next.
how to do it…
tks
want to change default_theme light to dark in progress running.
example: project start with theme light, but sometime, i want to change dark, and change light next.
how to do it…
tks
resolved by myself
reference lv_style example 14
static void new_theme_init_and_set(void)
{
/Initialize the styles/
lv_style_init(&style_btn);
lv_style_set_bg_color(&style_btn, lv_palette_main(LV_PALETTE_GREEN));
lv_style_set_border_color(&style_btn, lv_palette_darken(LV_PALETTE_GREEN, 3));
lv_style_set_border_width(&style_btn, 3);
/*Initialize the new theme from the current theme*/
lv_theme_t * th_act = lv_disp_get_theme(NULL);
static lv_theme_t th_new;
th_new = *th_act;
lv_theme_t *th_mono = lv_theme_mono_init(lv_disp_get_default(), false, LV_FONT_DEFAULT);
/*Set the parent theme and the style apply callback for the new theme*/
// lv_theme_set_parent(&th_new, th_act);
// lv_theme_set_apply_cb(&th_new, new_theme_apply_cb);
lv_theme_set_parent(th_mono, th_act);
/*Assign the new theme to the current display*/
// lv_disp_set_theme(NULL, &th_new);
lv_disp_set_theme(NULL, th_mono);
}