Description
I want to change the highlight color from blue to purple.
What MCU/Processor/Board and compiler are you using?
STM32F429/ GCC
What LVGL version are you using?
8.3.0
What do you want to achieve?
What have you tried so far?
Code to reproduce
static lv_style_t lv_style_dd;
static lv_style_t lv_style_dd_sel;
lv_style_init(&lv_style_dd);
lv_style_set_radius(&lv_style_dd, 5);
lv_style_set_bg_opa(&lv_style_dd, LV_OPA_100);
lv_style_set_bg_color(&lv_style_dd, GUI_COLOR_PURPLE);
lv_style_set_border_color(&lv_style_dd, GUI_COLOR_DARK_PURPLE);
lv_style_set_border_width(&lv_style_dd, 1);
lv_style_set_text_font(&lv_style_dd, &li_16);
lv_style_set_text_color(&lv_style_dd, GUI_COLOR_WHITE);
//lv_style_set_text_opa(&lv_style_dd, LV_OPA_COVER);
lv_style_init(&lv_style_dd_sel);
lv_style_set_radius(&lv_style_dd_sel, 0);
lv_style_set_bg_opa(&lv_style_dd_sel, LV_OPA_100);
lv_style_set_bg_color(&lv_style_dd_sel, GUI_COLOR_PURPLE);
lv_style_set_border_color(&lv_style_dd_sel, GUI_COLOR_DARK_PURPLE);
lv_style_set_border_width(&lv_style_dd_sel, 1);
lv_style_set_text_font(&lv_style_dd_sel, &li_16);
lv_style_set_text_color(&lv_style_dd_sel, GUI_COLOR_WHITE);
lv_style_set_text_opa(&lv_style_dd_sel, LV_OPA_COVER);
/Create a normal drop down list/
lv_obj_t* dd = lv_dropdown_create(parent);
lv_dropdown_set_options(dd,
“MM:DD:YY\n”
“DD:MM:YY\n”
“YY:MM:DD”
);
lv_obj_align(dd, LV_ALIGN_TOP_RIGHT, -5, 5);
//lv_obj_set_size(dd, 140, 35);
lv_obj_set_style_bg_color(dd, GUI_COLOR_PURPLE, 0);
lv_obj_set_style_border_color(dd, GUI_COLOR_DARK_PURPLE, 0);
lv_obj_set_style_text_color(dd, GUI_COLOR_WHITE, 0);
lv_obj_set_style_bg_color(dd, GUI_COLOR_PURPLE, LV_PART_ITEMS);
lv_obj_add_event_cb(dd, date_format_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_t* list = lv_dropdown_get_list(dd);
//lv_obj_remove_style_all(list);
lv_obj_add_style(list, &lv_style_dd, LV_PART_MAIN);
lv_obj_add_style(list, &lv_style_dd_sel, LV_PART_SELECTED | LV_STATE_CHECKED | LV_STATE_PRESSED);
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.