Set border color of LED object

I noticed that when creating a led object, all the colors including the background and border color relies on the led->color that is set on lv_led_set_color(). Can you make a function on lv_led.c which sets the border color of a led object directly, a function called lv_led_set_border_color()? Thanks!

@kisvegabor It would probably make the most sense for us to fire LV_EVENT_DRAW_PART_BEGIN with the pointer to rect_dsc; that way any of the colors can be customized. Otherwise, we would need to add an API for each of the colors (border, shadow, outline, etc.), which is just code duplication.

I agree on this somehow. However, I tried changing the led border color by using the lv_obj_set_style_border_color() but it doesn’t work. Please see the link below for the related question I posted on How-to section. Thanks!

I’ve pushed a fix to send events as @embeddedt suggested. I’ve tested with this code:

static void draw_event_cb(lv_event_t * e)
    lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
    if(dsc->part == LV_PART_MAIN) {
        dsc->rect_dsc->border_color = lv_color_hex3(0x0f0);


    lv_obj_t * led2  = lv_led_create(lv_scr_act());
    lv_obj_align(led2, LV_ALIGN_CENTER, 0, 0);
    lv_led_set_brightness(led2, 150);
    lv_led_set_color(led2, lv_palette_main(LV_PALETTE_RED));
    lv_obj_set_style_border_width(led2, 3, 0);
    lv_obj_add_event_cb(led2, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);

Tried the latest fix and verified that it’s working! Thank you very much @embeddedt @kisvegabor