Failing to change text color for label

Hi all,

I’m on a fork of lv_port_linux on 9.2.2.

I am trying to dynamically change some widget colors when I receive indication that a value is below a threshold. I detect the threshold and successfully change the border color, but the text color isn’t changing.

ret += lv_obj_set_style_text_color(range, lv_color_hex(calib_data->critical_battery_popup.text_color_hex_code), LV_PART_MAIN);
ret += lv_style_set_border_color(&style_dic, lv_color_hex(calib_data->critical_battery_popup.border_color_hex_code));
ret += lv_obj_set_style_text_color(dic_text_box, lv_color_hex(calib_data->critical_battery_popup.text_color_hex_code), LV_PART_MAIN);
syslog(LOG_DEBUG, "set range colors");
ret += lv_label_set_text(range, strcat(range_text, miles_not_km ? "mi" : "km"));
ret += lv_label_set_text(dic_text_box, calib_data->critical_battery_popup.text_message);
syslog(LOG_DEBUG, "set range texts");

Ignore the return values for the lvgl functions, that’s simply adding some NULL pointer checks on malloc calls. Any ideas why the color wouldn’t be changing. the text update after it works as well, but the color is the default.

Update: The border color wasn’t actually changing, so I added a lv_obj_invalidate() afterwards, and that fixed it. However, there is an lv_obj_invalidate called on the text labels in lv_label_set_text(), so I would expect the color changes to apply to the text labels once that is called. Still looking into text color changes.

Update: User error. I wasn’t properly setting the hex value.