mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
minor theme updates
This commit is contained in:
parent
e1a4590fe3
commit
e1989c5706
@ -174,7 +174,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
new_obj->style_p = th->style.bg;
|
||||
new_obj->style_p = th->style.scr;
|
||||
} else {
|
||||
new_obj->style_p = &lv_style_scr;
|
||||
}
|
||||
|
@ -87,7 +87,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new container*/
|
||||
if(copy == NULL) {
|
||||
/*Set the default styles*/
|
||||
/*Set the default styles if it's not screen*/
|
||||
if(par != NULL) {
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont);
|
||||
@ -95,6 +96,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
|
@ -34,6 +34,7 @@ typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_style_t * scr;
|
||||
lv_style_t * bg;
|
||||
lv_style_t * panel;
|
||||
|
||||
|
@ -32,6 +32,7 @@ static lv_font_t * _font;
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t bg;
|
||||
static lv_style_t scr;
|
||||
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||
@ -105,6 +106,12 @@ static void basic_init(void)
|
||||
bg.body.border.color = lv_color_hex3(0x666);
|
||||
bg.body.shadow.color = LV_COLOR_SILVER;
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
/*Panel*/
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
@ -133,6 +140,7 @@ static void basic_init(void)
|
||||
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t scr;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t sb;
|
||||
@ -54,6 +55,13 @@ static void basic_init(void)
|
||||
{
|
||||
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
||||
|
||||
|
||||
lv_style_copy(&scr, &def);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&sb, &lv_style_pretty_color);
|
||||
sb.body.grad_color = sb.body.main_color;
|
||||
sb.body.padding.right = sb.body.padding.right / 2; /*Make closer to the edges*/
|
||||
@ -64,6 +72,7 @@ static void basic_init(void)
|
||||
plain_bordered.body.border.color = lv_color_hex3(0xbbb);
|
||||
|
||||
theme.style.bg = &lv_style_plain;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &lv_style_pretty;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ static lv_font_t * _font;
|
||||
|
||||
static void basic_init(void)
|
||||
{
|
||||
static lv_style_t bg, panel;
|
||||
static lv_style_t bg, panel, scr;
|
||||
|
||||
lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/
|
||||
def.text.font = _font;
|
||||
@ -58,6 +58,12 @@ static void basic_init(void)
|
||||
bg.body.grad_color = bg.body.main_color;
|
||||
bg.body.radius = 0;
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = DEF_RADIUS;
|
||||
panel.body.main_color = LV_COLOR_WHITE;
|
||||
@ -84,6 +90,7 @@ static void basic_init(void)
|
||||
sb.body.padding.bottom = LV_DPI / 25;
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t scr;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t light_plain;
|
||||
@ -75,6 +76,13 @@ static void basic_init(void)
|
||||
def.image.intense = LV_OPA_TRANSP;
|
||||
def.image.opa = LV_OPA_COVER;
|
||||
|
||||
|
||||
lv_style_copy(&scr, &light_plain);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&light_plain, &def);
|
||||
|
||||
lv_style_copy(&light_frame, &light_plain);
|
||||
@ -92,6 +100,7 @@ static void basic_init(void)
|
||||
dark_frame.body.radius = LV_DPI / 20;
|
||||
|
||||
theme.style.bg = &def;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &light_frame;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ static lv_font_t * _font;
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t bg;
|
||||
static lv_style_t scr;
|
||||
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||
@ -107,6 +108,13 @@ static void basic_init(void)
|
||||
bg.body.border.color = lv_color_hex3(0x666);
|
||||
bg.body.shadow.color = LV_COLOR_SILVER;
|
||||
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
/*Panel*/
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
@ -134,6 +142,7 @@ static void basic_init(void)
|
||||
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t bg, sb, panel;
|
||||
static lv_style_t scr, bg, sb, panel;
|
||||
static lv_style_t prim, sec, hint;
|
||||
static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
|
||||
static lv_style_t bar_bg, bar_indic;
|
||||
@ -61,6 +61,12 @@ static void basic_init(void)
|
||||
bg.text.font = _font;
|
||||
bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
@ -86,6 +92,8 @@ static void basic_init(void)
|
||||
panel.body.padding.bottom = LV_DPI / 10;
|
||||
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40);
|
||||
panel.line.width = 1;
|
||||
|
||||
theme.style.scr = &scr;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &def;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ static void basic_init(void)
|
||||
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
||||
def.text.font = _font;
|
||||
|
||||
theme.style.scr = &def;
|
||||
theme.style.bg = &def;
|
||||
theme.style.panel = &def;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ static lv_font_t * _font;
|
||||
static void basic_init(void)
|
||||
{
|
||||
static lv_style_t bg;
|
||||
static lv_style_t scr;
|
||||
static lv_style_t panel;
|
||||
|
||||
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
||||
@ -60,6 +61,12 @@ static void basic_init(void)
|
||||
bg.body.border.width = 0;
|
||||
bg.body.shadow.width = 0;
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&panel, &bg);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
panel.body.border.width = 2;
|
||||
@ -80,6 +87,7 @@ static void basic_init(void)
|
||||
sb.body.radius = LV_RADIUS_CIRCLE;
|
||||
sb.body.padding.inner = LV_DPI / 10;
|
||||
|
||||
theme.style.scr = &scr;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user