How to change the color of an arc in a meter?


I want to change the color of the indicator arc during runtime. Take this example from the meter example page:

You add the arcs like this:

    /*Remove the circle from the middle*/
    lv_obj_remove_style(meter, NULL, LV_PART_INDICATOR);

    /*Add a three arc indicator*/
    lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_RED), 0);
    lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_GREEN), -10);
    lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_palette_main(LV_PALETTE_BLUE), -20);

But then after doing that, let’s say I want to make the red arc purple during runtime, how would I do that?

What LVGL version are you using?


What have you tried so far?

I’ve tried changing the color with lv_obj_set_style_arc_color and lv_obj_set_style_bg_color and probably some other things that I can’t remember trying.