Skip to content

Commit

Permalink
fix(theme): add arc, spinner and colorwheel to basic theme
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Jan 19, 2022
1 parent 345f688 commit adc218a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/lv_refr.c
Expand Up @@ -155,7 +155,7 @@ void lv_refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
draw_dsc.border_width = 1;
draw_dsc.border_opa = LV_OPA_30;
draw_dsc.border_color = debug_color;
lv_draw_rect(&obj_ext_mask, &obj_ext_mask, &draw_dsc);
lv_draw_rect(draw_ctx, &draw_dsc, &obj_coords_ext);
#endif

/*With overflow visible keep the previous clip area to let the children visible out of this object too
Expand Down
40 changes: 40 additions & 0 deletions src/extra/themes/basic/lv_theme_basic.c
Expand Up @@ -28,11 +28,16 @@
**********************/
typedef struct {
lv_style_t scr;
lv_style_t transp;
lv_style_t white;
lv_style_t light;
lv_style_t dark;
lv_style_t dim;
lv_style_t scrollbar;
#if LV_USE_ARC || LV_USE_COLORWHEEL
lv_style_t arc_line;
lv_style_t arc_knob;
#endif
#if LV_USE_TEXTAREA
lv_style_t ta_cursor;
#endif
Expand Down Expand Up @@ -72,6 +77,10 @@ static void style_init(void)
lv_style_set_bg_color(&styles->scr, COLOR_SCR);
lv_style_set_text_color(&styles->scr, COLOR_DIM);


style_init_reset(&styles->transp);
lv_style_set_bg_opa(&styles->transp, LV_OPA_TRANSP);

style_init_reset(&styles->white);
lv_style_set_bg_opa(&styles->white, LV_OPA_COVER);
lv_style_set_bg_color(&styles->white, COLOR_WHITE);
Expand Down Expand Up @@ -105,6 +114,13 @@ static void style_init(void)
lv_style_set_arc_width(&styles->dim, 2);
lv_style_set_arc_color(&styles->dim, COLOR_DIM);

#if LV_USE_ARC || LV_USE_COLORWHEEL
style_init_reset(&styles->arc_line);
lv_style_set_arc_width(&styles->arc_line, 6);
style_init_reset(&styles->arc_knob);
lv_style_set_pad_all(&styles->arc_knob, 5);
#endif

#if LV_USE_TEXTAREA
style_init_reset(&styles->ta_cursor);
lv_style_set_border_side(&styles->ta_cursor, LV_BORDER_SIDE_LEFT);
Expand Down Expand Up @@ -294,8 +310,32 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
#if LV_USE_ARC
else if(lv_obj_check_type(obj, &lv_arc_class)) {
lv_obj_add_style(obj, &styles->light, 0);
lv_obj_add_style(obj, &styles->transp, 0);
lv_obj_add_style(obj, &styles->arc_line, 0);
lv_obj_add_style(obj, &styles->dark, LV_PART_INDICATOR);
lv_obj_add_style(obj, &styles->arc_line, LV_PART_INDICATOR);
lv_obj_add_style(obj, &styles->dim, LV_PART_KNOB);
lv_obj_add_style(obj, &styles->arc_knob, LV_PART_KNOB);
}
#endif

#if LV_USE_SPINNER
else if(lv_obj_check_type(obj, &lv_spinner_class)) {
lv_obj_add_style(obj, &styles->light, 0);
lv_obj_add_style(obj, &styles->transp, 0);
lv_obj_add_style(obj, &styles->arc_line, 0);
lv_obj_add_style(obj, &styles->dark, LV_PART_INDICATOR);
lv_obj_add_style(obj, &styles->arc_line, LV_PART_INDICATOR);
}
#endif

#if LV_USE_COLORWHEEL
else if(lv_obj_check_type(obj, &lv_colorwheel_class)) {
lv_obj_add_style(obj, &styles->light, 0);
lv_obj_add_style(obj, &styles->transp, 0);
lv_obj_add_style(obj, &styles->arc_line, 0);
lv_obj_add_style(obj, &styles->dim, LV_PART_KNOB);
lv_obj_add_style(obj, &styles->arc_knob, LV_PART_KNOB);
}
#endif

Expand Down

0 comments on commit adc218a

Please sign in to comment.