Font displaying odd when darkening the background

Description

In my dropdown list I have set the selected option’s background to be slightly darker than the rest. I use the function lv_color_darken(lv_color_hex(0xf1f1f1), 10) to make the color. My problem is that the font is suddenly appearing quite choppy compared to the rest. Is this a “bug” or just something to be expected? It might just be because the colors are to alike but I wanted to check

What MCU/Processor/Board and compiler are you using?

Simulator

What LVGL version are you using?

The newest to my knowledge

What do you want to achieve?

I would like to know why the text is so “rough” and if there is a way to fix it.

What have you tried so far?

I honestly don’t really know what to try.

Code to reproduce

Here is were I describe the style.

The code block(s) should be formatted like:

    lv_obj_set_style_local_text_color(DropdownList, LV_DROPDOWN_PART_SELECTED, LV_STATE_DEFAULT, LV_COLOR_GRAY);
    lv_obj_set_style_local_bg_color  (DropdownList, LV_DROPDOWN_PART_SELECTED, LV_STATE_DEFAULT, lv_color_darken(lv_color_hex(0xf1f1f1), 10));

As you can see the selected option is quite “blurry”
image

I think this is another manifestation of an LVGL bug where text gets drawn twice in some spots. AFAIK this case was fixed in v8 but I don’t think the fix was backported to v7.

(cc @kisvegabor)

Okay, super. I remember I experienced something like that before :smiley:. I’ll try to do a bit of digging then

I think i might have fixed it, or at least I have found what’s causing the problem: here
I just commented one of the draw_box_label functions out, but maybe there’s just missing an else and some brackets. I’m not too sure, but that might be the fix

Adding an else looks like the correct fix there. Do you want to send a PR to master?

Yeah, i could do that. If i can figure it out :smile:

@embeddedt. I did some testing before sending a PR and the else with brackets unfortunately didn’t fix the problem. After tinkering around I haven’t come up with a “clean” fix, it seems that lv_dropdown_page_design() is called twice with the mode being LV_DESIGN_DRAW_POST, or so I imagine at least. I’m lacking insight right now but I’ll try and see if something else seemingly obvious appears

Might this line: here just be redundant? If I comment out the line it seems to work perfectly normal, but on the other hand I don’t really know what the “intent” is behind that function, other than it gets called periodically when the dropdown list is open, so I imagine its to refresh the labels right?