refactor(color) refactor the palette API

This commit is contained in:
Gabor Kiss-Vamosi
2021-04-23 12:46:14 +02:00
parent a9bedcf335
commit 070df61eb2
47 changed files with 271 additions and 640 deletions

View File

@@ -12,8 +12,8 @@ static void event_cb(lv_event_t * e)
/*Change the draw descriptor the 2nd button*/
if(dsc->id == 1) {
dsc->rect_dsc->radius = 0;
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_blue_darken_3();
else dsc->rect_dsc->bg_color = lv_color_blue();
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_palette_darken(LV_PALETTE_GREY, 3);
else dsc->rect_dsc->bg_color = lv_palette_main(LV_PALETTE_BLUE);
dsc->rect_dsc->shadow_width = 6;
dsc->rect_dsc->shadow_ofs_x = 3;
@@ -23,8 +23,8 @@ static void event_cb(lv_event_t * e)
/*Change the draw descriptor the 3rd button*/
else if(dsc->id == 2) {
dsc->rect_dsc->radius = LV_RADIUS_CIRCLE;
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_red_darken_3();
else dsc->rect_dsc->bg_color = lv_color_red();
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_palette_darken(LV_PALETTE_RED, 3);
else dsc->rect_dsc->bg_color = lv_palette_main(LV_PALETTE_RED);
dsc->label_dsc->color = lv_color_white();
}

View File

@@ -40,7 +40,7 @@ void lv_example_btnmatrix_3(void)
lv_style_set_radius(&style_btn, 0);
lv_style_set_border_width(&style_btn, 1);
lv_style_set_border_opa(&style_btn, LV_OPA_50);
lv_style_set_border_color(&style_btn, lv_color_grey());
lv_style_set_border_color(&style_btn, lv_palette_main(LV_PALETTE_GREY));
lv_style_set_border_side(&style_btn, LV_BORDER_SIDE_INTERNAL);
lv_style_set_radius(&style_btn, 0);