LVGL ESP32 Background colour for lv_label
Posted: Sun Jan 02, 2022 4:47 am
trying to change the background colour of the label
not sure what is wrong here
not sure what is wrong here
- lv_obj_t *headingLabel = lv_label_create(active_screen, NULL);
- lv_label_set_text(headingLabel, "Heading"); /*Set the labels text*/
- lv_obj_set_pos(headingLabel, lv_obj_get_width(list1), 0);
- lv_obj_align(headingLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
- lv_obj_set_style_local_text_color(headingLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
- // set background colour of label
- lv_obj_set_style_local_bg_color(headingLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_PURPLE);
- lv_obj_set_style_local_text_font(headingLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_montserrat_42);