Description
I would like to set different colors for a button in TOGGLED and in RELEASED state. In the documentation of the Button object there is no separate style for “toggled” state.
What MCU/Processor/Board and compiler are you using?
PC Simulator - SDL2
What do you want to achieve?
Different colors for a button in TOGGLED and in RELEASED state
What have you tried so far?
LV_BTN_STYLE_REL is already set to the wanted color. I also tried LV_BTN_STYLE_PR and LV_BTN_STYLE_TGL_PR without success.
Code to reproduce
The code is the following: first part is for the released state color setting --> works
2nd part would be for the “toggled” state, but neither LV_BTN_STYLE_TGL_PR or LV_BTN_STYLE_PR produces the result I want. There should be a LV_BTN_STYLE_TOGGLED style as well?
/* Set toggled release style */
static lv_style_t styleBtnAutoManualTglRel;
lv_style_copy(&styleBtnAutoManualTglRel,lv_btn_get_style(btnAutoManual, LV_BTN_STYLE_REL));
styleBtnAutoManualTglRel.body.main_color = LV_COLOR_GREEN;
styleBtnAutoManualTglRel.body.grad_color = LV_COLOR_GREEN;
lv_btn_set_style(btnAutoManual,LV_BTN_STYLE_REL,&styleBtnAutoManualTglRel);
/* Set toggled applied style */
static lv_style_t styleBtnAutoManualTglPr;
lv_style_copy(&styleBtnAutoManualTglPr,lv_btn_get_style(btnAutoManual, LV_BTN_STYLE_TGL_PR));
styleBtnAutoManualTglPr.body.main_color = LV_COLOR_RED;
styleBtnAutoManualTglPr.body.grad_color = LV_COLOR_RED;
lv_btn_set_style(btnAutoManual,LV_BTN_STYLE_TGL_PR,&styleBtnAutoManualTglPr);
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.