ARC bg changing when knob dragged

Hi Team,
When the arc knob dragged the background of the arc changed.
i just added style_bg for arc and not changing arc bg any where. why the background changes to white?

//style_bg
         static lv_style_t style_bg;
         lv_style_init(&style_bg);
         lv_style_set_bg_color(&style_bg,LV_STATE_DEFAULT, LV_COLOR_BG);
         lv_obj_add_style(lv_scr_act(),LV_OBJ_PART_MAIN, &style_bg);

/*Create an Arc*/
      dimmer = lv_arc_create(lv_scr_act(), NULL);
      lv_obj_set_size(dimmer, 350, 350);
      lv_arc_set_adjustable(dimmer,true);
      lv_arc_set_range(dimmer,0,100);
      lv_obj_add_style(dimmer,LV_OBJ_PART_MAIN, &style_bg);
      lv_obj_align(dimmer, NULL, LV_ALIGN_CENTER, 0, 0);
      lv_obj_set_event_cb(dimmer, arc_event_cb);

//event handler
static void arc_event_cb(lv_obj_t * dimmer, lv_event_t event)
{
    static char buf[4];
    if(event == LV_EVENT_RELEASED){
        snprintf(buf, 4, "%u", lv_arc_get_value(dimmer));
              if(buf==0){
                  lv_label_set_text(level,strcat(buf," %"));
               }else if(buf>0){
                  lv_label_set_text(level,strcat(buf," %"));
          }
        }
}

i am using style_bg for arc background. please find the above code.
when i drag the knob the background of the arc changed to white.
Please find the attached images
Image with style_bg:


image after knob changed:

Please help me with this.
Thanks in Advance.

Hi team is any update ?

Dear chandumanem,

it’s welcome that you try to learn programming, but I’m not sure whether this is the right forum for that matter.

You again are writing beyond your character buffer.
You have only 4 (four) bytes reserved to store your dimmer number string.
Think about, how long your string could be in the worst scenario (including the " %" and the 0 termination of the string)!
And than look at your reserved buffer (buf[4]).

And it is also not clear what the if (buf == 0) and elseif (buf > 0) is good for.

I didn’t even notice that the first time. How does that even compile? I guess the array is being converted to a pointer, but that would normally trigger a warning and/or error.

With char buf [4], buf is equivalent to char* buf. Just a simple pointer.

And you are right the (buf > 0) emits a warning (at least with gcc):

warning: ordered comparison of pointer with integer zero [-Wextra]

In case of a pointer, a else would be enough.
But the if () else if () makes no sense either because both lv_label_set_text (…) are identical.