LVGL ESP32 Background colour for lv_label

ESPCrazy
Posts: 2
Joined: Sat Oct 30, 2021 11:10 pm

LVGL ESP32 Background colour for lv_label

Postby ESPCrazy » Sun Jan 02, 2022 4:47 am

trying to change the background colour of the label
not sure what is wrong here

  1. lv_obj_t *headingLabel = lv_label_create(active_screen, NULL);
  2.  
  3.     lv_label_set_text(headingLabel, "Heading"); /*Set the labels text*/
  4.  
  5.     lv_obj_set_pos(headingLabel, lv_obj_get_width(list1), 0);
  6.     lv_obj_align(headingLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
  7.     lv_obj_set_style_local_text_color(headingLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
  8. // set background colour of label
  9.    lv_obj_set_style_local_bg_color(headingLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_PURPLE);
  10.     lv_obj_set_style_local_text_font(headingLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_montserrat_42);
  11.  

Baldhead
Posts: 468
Joined: Sun Mar 31, 2019 5:16 am

Re: LVGL ESP32 Background colour for lv_label

Postby Baldhead » Sun Jan 02, 2022 5:52 am

Not the right place to ask.

Try lvgl forum page.

https://forum.lvgl.io/

Jamawa
Posts: 16
Joined: Sun Aug 16, 2020 10:46 am

Re: LVGL ESP32 Background colour for lv_label

Postby Jamawa » Wed Jan 05, 2022 8:30 pm

If I remember correctly, it is something like that the text background is not opaque by default. Try setting the opacity to full, otherwise you’re indeed far more likely to get a response on the LVGL forum

Who is online

Users browsing this forum: Gaston1980 and 223 guests