Description
How to apply “disabled” styling to checkbox text via theme
What MCU/Processor/Board and compiler are you using?
Teensy 4.1 and GCC 9
What LVGL version are you using?
8.0.1
What do you want to achieve?
World domination. And greyed-out checkbox text
What have you tried so far?
Code to reproduce
Using the default theme in 8.0.1, the following:
lv_obj_add_state(btn, LV_STATE_DISABLED);
appears to apply the grey filter to the button and the label associated with the button. However, when the disabled state is applied to a checkbox, only the box itself is affected, not the checkbox text.
The default theme for the button has:
lv_obj_add_style(obj, &styles->disabled, LV_STATE_DISABLED);
but the checkbox has:
lv_obj_add_style(obj, &styles->disabled, LV_PART_INDICATOR | LV_STATE_DISABLED);
Up until now, this makes sense to me, expected behavior. However, if I try adding either of these lines to the checkbox styling in lv_theme_default.c
:
lv_obj_add_style(obj, &styles->disabled, LV_PART_MAIN | LV_STATE_DISABLED);
lv_obj_add_style(obj, &styles->disabled, LV_STATE_DISABLED);
It does not have an impact on the checkbox text. What am I missing?
(If I add text_color to &styles->disabled
, this is applied to the checkbox text due to the above lines, so I feel like the style is being applied to the checkbox text)