Overriding theme

What do you want to achieve?

Overriding the active theme so I can make my own.
I tried the sample on Examples - LVGL 9.4 documentation but it gives :

error: storage size of 'th_new' isn't known

What have you tried so far?

It worked until upgrading to embedded LVGL 9 (Zephyr upgrade).

Code to reproduce

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_display_get_theme(NULL);
    static lv_theme_t th_new;
    th_new = *th_act;

    /*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);

    /*Assign the new theme to the current display*/
    lv_display_set_theme(NULL, &th_new);
}

Environment

  • MCU/MPU/Board: nrf52840dk
  • LVGL version: 9.3

Thanks for your help !

AnomalySmith.