lv_theme_night ready

This commit is contained in:
Gabor Kiss-Vamosi
2017-11-22 23:04:02 +01:00
parent b90f3c7d32
commit c5b9a4eb17
7 changed files with 159 additions and 105 deletions

View File

@@ -64,9 +64,9 @@
#define USE_LV_THEME_TEMPL 0 /*Just for test*/ #define USE_LV_THEME_TEMPL 0 /*Just for test*/
#define USE_LV_THEME_DEFAULT 0 /*Built manly from the built-in styles. Consumes very few RAM*/ #define USE_LV_THEME_DEFAULT 0 /*Built manly from the built-in styles. Consumes very few RAM*/
#define USE_LV_THEME_ALIEN 0 /*Dark futuristic theme*/ #define USE_LV_THEME_ALIEN 0 /*Dark futuristic theme*/
#define USE_LV_THEME_NIGHT 0 /*Dark elegant theme*/
#define USE_LV_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows (Planned)*/ #define USE_LV_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows (Planned)*/
#define USE_LV_THEME_ZEN 0 /*Peaceful, mainly black and white theme (Planned)*/ #define USE_LV_THEME_ZEN 0 /*Peaceful, mainly black and white theme (Planned)*/
#define USE_LV_THEME_NIGHT 0 /*Dark elegant theme (Planned)*/
/*================== /*==================
* LV OBJ X USAGE * LV OBJ X USAGE

View File

@@ -83,7 +83,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
/*Set the default styles*/ /*Set the default styles*/
lv_theme_t *th = lv_theme_get_current(); lv_theme_t *th = lv_theme_get_current();
if(th) { if(th) {
lv_cont_set_style(new_cont, th->cont.filled); lv_cont_set_style(new_cont, th->cont);
} else { } else {
lv_cont_set_style(new_cont, &lv_style_pretty); lv_cont_set_style(new_cont, &lv_style_pretty);
} }

View File

@@ -29,10 +29,7 @@ typedef struct {
lv_style_t *panel; lv_style_t *panel;
#if USE_LV_CONT != 0 #if USE_LV_CONT != 0
struct { lv_style_t *cont;
lv_style_t *filled;
lv_style_t *frame;
}cont;
#endif #endif
#if USE_LV_BTN != 0 #if USE_LV_BTN != 0
struct { struct {
@@ -205,7 +202,6 @@ typedef struct {
#if USE_LV_TABVIEW != 0 #if USE_LV_TABVIEW != 0
struct { struct {
lv_style_t *bg; lv_style_t *bg;
lv_style_t *sb;
lv_style_t *indic; lv_style_t *indic;
struct { struct {
lv_style_t *bg; lv_style_t *bg;

View File

@@ -587,17 +587,17 @@ static void roller_init(void)
lv_style_copy(&roller_bg, &ddlist_bg); lv_style_copy(&roller_bg, &ddlist_bg);
roller_bg.text.line_space = LV_DPI / 6; roller_bg.text.line_space = LV_DPI / 6;
roller_bg.body.radius = LV_DPI / 20; roller_bg.body.radius = LV_DPI / 20;
roller_bg.body.main_color = COLOR_HEX3(0x333); roller_bg.body.main_color = COLOR_HEX3(0x222);
roller_bg.body.grad_color = COLOR_HEX3(0x999); roller_bg.body.grad_color = COLOR_HEX3(0x666);
roller_bg.body.border.opa = OPA_30; roller_bg.body.border.opa = OPA_30;
roller_bg.text.opa = OPA_70; roller_bg.text.opa = OPA_70;
roller_bg.text.color = color_hsv_to_rgb(_hue, 20, 70); roller_bg.text.color = color_hsv_to_rgb(_hue, 20, 70);
roller_bg.body.shadow.width = LV_DPI / 20; roller_bg.body.shadow.width = 0;
roller_bg.body.shadow.color = COLOR_HEX3(0x444);
lv_style_copy(&roller_sel, &panel); lv_style_copy(&roller_sel, &panel);
roller_sel.body.empty = 1; roller_sel.body.empty = 1;
roller_sel.body.radius = 0; roller_sel.body.radius = 0;
roller_sel.text.opa = OPA_COVER;
roller_sel.text.color = color_hsv_to_rgb(_hue, 70, 95); roller_sel.text.color = color_hsv_to_rgb(_hue, 70, 95);
theme.roller.bg = &roller_bg; theme.roller.bg = &roller_bg;
@@ -613,7 +613,7 @@ static void tabview_init(void)
tab_rel.body.main_color = COLOR_HEX3(0x666); tab_rel.body.main_color = COLOR_HEX3(0x666);
tab_rel.body.grad_color = COLOR_HEX3(0x666); tab_rel.body.grad_color = COLOR_HEX3(0x666);
tab_rel.body.padding.hor = 0; tab_rel.body.padding.hor = 0;
tab_rel.body.padding.ver = 0; tab_rel.body.padding.ver = LV_DPI / 6;
tab_rel.body.padding.inner = 0; tab_rel.body.padding.inner = 0;
tab_rel.body.border.width = 1 << LV_ANTIALIAS; tab_rel.body.border.width = 1 << LV_ANTIALIAS;
tab_rel.body.border.color = COLOR_SILVER; tab_rel.body.border.color = COLOR_SILVER;
@@ -628,7 +628,7 @@ static void tabview_init(void)
lv_style_copy(&tab_trel, &def); lv_style_copy(&tab_trel, &def);
tab_trel.body.empty = 1; tab_trel.body.empty = 1;
tab_trel.body.padding.hor = 0; tab_trel.body.padding.hor = 0;
tab_trel.body.padding.ver = 0; tab_trel.body.padding.ver = LV_DPI / 6;
tab_trel.body.padding.inner = 0; tab_trel.body.padding.inner = 0;
tab_trel.body.border.width = 1 << LV_ANTIALIAS; tab_trel.body.border.width = 1 << LV_ANTIALIAS;
tab_trel.body.border.color = COLOR_SILVER; tab_trel.body.border.color = COLOR_SILVER;
@@ -640,7 +640,7 @@ static void tabview_init(void)
tab_tpr.body.main_color = COLOR_GRAY; tab_tpr.body.main_color = COLOR_GRAY;
tab_tpr.body.grad_color = COLOR_GRAY; tab_tpr.body.grad_color = COLOR_GRAY;
tab_tpr.body.padding.hor = 0; tab_tpr.body.padding.hor = 0;
tab_tpr.body.padding.ver = 0; tab_tpr.body.padding.ver = LV_DPI / 6;
tab_tpr.body.padding.inner = 0; tab_tpr.body.padding.inner = 0;
tab_tpr.body.border.width = 1 << LV_ANTIALIAS; tab_tpr.body.border.width = 1 << LV_ANTIALIAS;
tab_tpr.body.border.color = COLOR_SILVER; tab_tpr.body.border.color = COLOR_SILVER;

View File

@@ -74,11 +74,11 @@ static void basic_init(void)
static void btn_init(void) static void btn_init(void)
{ {
#if USE_LV_BTN != 0 #if USE_LV_BTN != 0
theme.btn.rel = &lv_style_btn_released; theme.btn.rel = &lv_style_btn_rel;
theme.btn.pr = &lv_style_btn_pressed; theme.btn.pr = &lv_style_btn_pr;
theme.btn.tgl_rel = &lv_style_btn_tgl_rel; theme.btn.tgl_rel = &lv_style_btn_tgl_rel;
theme.btn.tgl_pr = &lv_style_btn_tgl_pressed; theme.btn.tgl_pr = &lv_style_btn_tgl_pr;
theme.btn.ina = &lv_style_btn_inactive; theme.btn.ina = &lv_style_btn_ina;
#endif #endif
} }
@@ -213,10 +213,10 @@ static void cb_init(void)
theme.cb.bg = &lv_style_transp; theme.cb.bg = &lv_style_transp;
theme.cb.box.rel = &lv_style_pretty; theme.cb.box.rel = &lv_style_pretty;
theme.cb.box.pr = &lv_style_btn_pressed; theme.cb.box.pr = &lv_style_btn_pr;
theme.cb.box.tgl_rel = &lv_style_btn_tgl_rel; theme.cb.box.tgl_rel = &lv_style_btn_tgl_rel;
theme.cb.box.tgl_pr = &lv_style_btn_tgl_pressed; theme.cb.box.tgl_pr = &lv_style_btn_tgl_pr;
theme.cb.box.ina = &lv_style_btn_inactive; theme.cb.box.ina = &lv_style_btn_ina;
#endif #endif
} }
@@ -227,11 +227,11 @@ static void btnm_init(void)
theme.btnm.bg = &lv_style_pretty; theme.btnm.bg = &lv_style_pretty;
theme.btnm.btn.rel = &lv_style_btn_released; theme.btnm.btn.rel = &lv_style_btn_rel;
theme.btnm.btn.pr = &lv_style_btn_pressed; theme.btnm.btn.pr = &lv_style_btn_pr;
theme.btnm.btn.tgl_rel = &lv_style_btn_tgl_rel; theme.btnm.btn.tgl_rel = &lv_style_btn_tgl_rel;
theme.btnm.btn.tgl_pr = &lv_style_btn_tgl_pressed; theme.btnm.btn.tgl_pr = &lv_style_btn_tgl_pr;
theme.btnm.btn.ina = &lv_style_btn_inactive; theme.btnm.btn.ina = &lv_style_btn_ina;
#endif #endif
} }
@@ -241,11 +241,11 @@ static void kb_init(void)
theme.kb.bg = &lv_style_pretty; theme.kb.bg = &lv_style_pretty;
theme.kb.btn.rel = &lv_style_btn_released; theme.kb.btn.rel = &lv_style_btn_rel;
theme.kb.btn.pr = &lv_style_btn_pressed; theme.kb.btn.pr = &lv_style_btn_pr;
theme.kb.btn.tgl_rel = &lv_style_btn_tgl_rel; theme.kb.btn.tgl_rel = &lv_style_btn_tgl_rel;
theme.kb.btn.tgl_pr = &lv_style_btn_tgl_pressed; theme.kb.btn.tgl_pr = &lv_style_btn_tgl_pr;
theme.kb.btn.ina = &lv_style_btn_inactive; theme.kb.btn.ina = &lv_style_btn_ina;
#endif #endif
} }
@@ -257,8 +257,8 @@ static void mbox_init(void)
theme.mbox.bg = &lv_style_pretty; theme.mbox.bg = &lv_style_pretty;
theme.mbox.btn.bg = &lv_style_transp; theme.mbox.btn.bg = &lv_style_transp;
theme.mbox.btn.rel = &lv_style_btn_released; theme.mbox.btn.rel = &lv_style_btn_rel;
theme.mbox.btn.pr = &lv_style_btn_tgl_pressed; theme.mbox.btn.pr = &lv_style_btn_tgl_pr;
#endif #endif
} }
@@ -293,11 +293,11 @@ static void list_init(void)
theme.list.bg = &lv_style_pretty; theme.list.bg = &lv_style_pretty;
theme.list.scrl = &lv_style_transp; theme.list.scrl = &lv_style_transp;
theme.list.sb = &sb; theme.list.sb = &sb;
theme.list.btn.rel = &lv_style_btn_released; theme.list.btn.rel = &lv_style_btn_rel;
theme.list.btn.pr = &lv_style_btn_pressed; theme.list.btn.pr = &lv_style_btn_pr;
theme.list.btn.tgl_rel = &lv_style_btn_tgl_rel; theme.list.btn.tgl_rel = &lv_style_btn_tgl_rel;
theme.list.btn.tgl_pr = &lv_style_btn_tgl_pressed; theme.list.btn.tgl_pr = &lv_style_btn_tgl_pr;
theme.list.btn.ina = &lv_style_btn_inactive; theme.list.btn.ina = &lv_style_btn_ina;
#endif #endif
} }
@@ -328,13 +328,12 @@ static void tabview_init(void)
theme.tabview.bg = &plain_bordered; theme.tabview.bg = &plain_bordered;
theme.tabview.sb = &sb;
theme.tabview.indic = &lv_style_plain_color; theme.tabview.indic = &lv_style_plain_color;
theme.tabview.btn.bg = &lv_style_transp; theme.tabview.btn.bg = &lv_style_transp;
theme.tabview.btn.rel = &lv_style_btn_released; theme.tabview.btn.rel = &lv_style_btn_rel;
theme.tabview.btn.pr = &lv_style_btn_pressed; theme.tabview.btn.pr = &lv_style_btn_pr;
theme.tabview.btn.tgl_rel = &lv_style_btn_tgl_rel; theme.tabview.btn.tgl_rel = &lv_style_btn_tgl_rel;
theme.tabview.btn.tgl_pr = &lv_style_btn_tgl_pressed; theme.tabview.btn.tgl_pr = &lv_style_btn_tgl_pr;
#endif #endif
} }
@@ -349,8 +348,8 @@ static void win_init(void)
theme.win.header = &lv_style_plain_color; theme.win.header = &lv_style_plain_color;
theme.win.content.bg = &lv_style_transp; theme.win.content.bg = &lv_style_transp;
theme.win.content.scrl = &lv_style_transp; theme.win.content.scrl = &lv_style_transp;
theme.win.btn.rel = &lv_style_btn_released; theme.win.btn.rel = &lv_style_btn_rel;
theme.win.btn.pr = &lv_style_btn_pressed; theme.win.btn.pr = &lv_style_btn_pr;
#endif #endif
} }
@@ -412,7 +411,7 @@ lv_theme_t * lv_theme_default_init(uint16_t hue, font_t *font)
* Get a pointer to the theme * Get a pointer to the theme
* @return pointer to the theme * @return pointer to the theme
*/ */
lv_theme_t * lv_theme_get_templ(void) lv_theme_t * lv_theme_get_default(void)
{ {
return &theme; return &theme;
} }

View File

@@ -32,7 +32,7 @@ static lv_theme_t theme;
static lv_style_t def; static lv_style_t def;
/*Static style definitions*/ /*Static style definitions*/
static lv_style_t bg; static lv_style_t bg, sb, panel;
static lv_style_t prim, sec, hint; 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 btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
static lv_style_t bar_bg, bar_indic; static lv_style_t bar_bg, bar_indic;
@@ -61,10 +61,41 @@ static void basic_init(void)
bg.body.grad_color = color_hsv_to_rgb(_hue, 11, 30); bg.body.grad_color = color_hsv_to_rgb(_hue, 11, 30);
bg.text.color = color_hsv_to_rgb(_hue, 5, 95); bg.text.color = color_hsv_to_rgb(_hue, 5, 95);
lv_style_copy(&sb, &def);
sb.body.main_color = color_hsv_to_rgb(_hue, 30, 60);
sb.body.grad_color = color_hsv_to_rgb(_hue, 30, 60);
sb.body.border.width = 0;
sb.body.padding.inner = LV_DPI / 10;
sb.body.padding.ver = 0;
sb.body.padding.hor = 0;
sb.body.radius = LV_DPI / 30;
sb.body.opa = OPA_COVER;
lv_style_copy(&panel, &bg);
panel.body.main_color = color_hsv_to_rgb(_hue, 11, 18);
panel.body.grad_color = color_hsv_to_rgb(_hue, 11, 18);
panel.body.radius = LV_DPI / 20;
panel.body.border.color = color_hsv_to_rgb(_hue, 10, 25);
panel.body.border.width = 1 << LV_AA;
panel.body.border.opa = OPA_COVER;
panel.body.padding.ver = LV_DPI / 10;
panel.body.padding.hor = LV_DPI / 10;
panel.line.color = color_hsv_to_rgb(_hue, 20, 40);
panel.line.width = 1 << LV_AA;
theme.bg = &bg; theme.bg = &bg;
theme.panel = &def; theme.panel = &def;
} }
static void cont_init(void)
{
#if USE_LV_CONT != 0
theme.cont = &panel;
#endif
}
static void btn_init(void) static void btn_init(void)
{ {
#if USE_LV_BTN != 0 #if USE_LV_BTN != 0
@@ -154,21 +185,27 @@ static void line_init(void)
static void led_init(void) static void led_init(void)
{ {
#if USE_LV_LED != 0 #if USE_LV_LED != 0
static lv_style_t led;
lv_style_copy(&led, &lv_style_pretty_color);
led.body.shadow.width = LV_DPI / 10;
led.body.radius = LV_RADIUS_CIRCLE;
led.body.border.width= LV_DPI / 30;
led.body.border.opa = OPA_30;
led.body.main_color = color_hsv_to_rgb(_hue, 100, 100);
led.body.grad_color = color_hsv_to_rgb(_hue, 100, 40);
led.body.border.color = color_hsv_to_rgb(_hue, 60, 60);
led.body.shadow.color = color_hsv_to_rgb(_hue, 100, 100);
theme.led = &led;
theme.led = &def;
#endif #endif
} }
static void bar_init(void) static void bar_init(void)
{ {
#if USE_LV_BAR #if USE_LV_BAR
lv_style_copy(&bar_bg, &lv_style_pretty); lv_style_copy(&bar_bg, &panel);
bar_bg.body.main_color = color_hsv_to_rgb(_hue, 10, 15); bar_bg.body.padding.ver = LV_DPI / 16;
bar_bg.body.grad_color = color_hsv_to_rgb(_hue, 10, 15); bar_bg.body.padding.hor = LV_DPI / 16;
bar_bg.body.border.color = color_hsv_to_rgb(_hue, 10, 10);
bar_bg.body.border.width = 1 << LV_AA;
bar_bg.body.border.opa = OPA_COVER;
bar_bg.body.radius = LV_RADIUS_CIRCLE; bar_bg.body.radius = LV_RADIUS_CIRCLE;
lv_style_copy(&bar_indic, &lv_style_pretty); lv_style_copy(&bar_indic, &lv_style_pretty);
@@ -217,7 +254,7 @@ static void lmeter_init(void)
#if USE_LV_LMETER != 0 #if USE_LV_LMETER != 0
lv_style_copy(&lmeter_bg, &def); lv_style_copy(&lmeter_bg, &def);
lmeter_bg.body.main_color = color_hsv_to_rgb(_hue, 10, 70); lmeter_bg.body.main_color = color_hsv_to_rgb(_hue, 10, 70);
lmeter_bg.body.grad_color = color_hsv_to_rgb(_hue, 80, 80); lmeter_bg.body.grad_color = color_hsv_to_rgb(_hue, 95, 90);
lmeter_bg.body.padding.hor = LV_DPI / 10; /*Scale line length*/ lmeter_bg.body.padding.hor = LV_DPI / 10; /*Scale line length*/
lmeter_bg.body.padding.inner = LV_DPI / 10; /*Text padding*/ lmeter_bg.body.padding.inner = LV_DPI / 10; /*Text padding*/
lmeter_bg.body.border.color = COLOR_HEX3(0x333); lmeter_bg.body.border.color = COLOR_HEX3(0x333);
@@ -242,7 +279,7 @@ static void chart_init(void)
{ {
#if USE_LV_CHART #if USE_LV_CHART
theme.chart = &def; theme.chart = &panel;
#endif #endif
} }
@@ -250,11 +287,43 @@ static void cb_init(void)
{ {
#if USE_LV_CB != 0 #if USE_LV_CB != 0
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
lv_style_copy(&rel, &def);
rel.body.radius = LV_DPI / 20;
rel.body.main_color = color_hsv_to_rgb(_hue, 10, 95);
rel.body.grad_color = color_hsv_to_rgb(_hue, 10, 95);
rel.body.border.color = color_hsv_to_rgb(_hue, 10, 50);
rel.body.border.width = 2 << LV_AA;;
lv_style_copy(&pr, &rel);
pr.body.main_color = color_hsv_to_rgb(_hue, 10, 80);
pr.body.grad_color = color_hsv_to_rgb(_hue, 10, 80);
pr.body.border.color = color_hsv_to_rgb(_hue, 10, 20);
pr.body.border.width = 1 << LV_AA;;
lv_style_copy(&tgl_rel, &rel);
tgl_rel.body.main_color = color_hsv_to_rgb(_hue, 80, 90);
tgl_rel.body.grad_color = color_hsv_to_rgb(_hue, 80, 90);
tgl_rel.body.border.color = color_hsv_to_rgb(_hue, 80, 50);
lv_style_copy(&tgl_pr, &tgl_rel);
tgl_pr.body.main_color = color_hsv_to_rgb(_hue, 80, 70);
tgl_pr.body.grad_color = color_hsv_to_rgb(_hue, 80, 70);
tgl_pr.body.border.color = color_hsv_to_rgb(_hue, 80, 30);
tgl_pr.body.border.width = 1 << LV_AA;;
lv_style_copy(&ina, &rel);
ina.body.main_color = COLOR_HEX3(0x777);
ina.body.grad_color = COLOR_HEX3(0x777);
ina.body.border.width = 0;
theme.cb.bg = &lv_style_transp; theme.cb.bg = &lv_style_transp;
theme.cb.box.rel = &def; theme.cb.box.rel = &rel;
theme.cb.box.pr = &def; theme.cb.box.pr = &pr;
theme.cb.box.tgl_rel = &def; theme.cb.box.tgl_rel = &tgl_rel;
theme.cb.box.tgl_pr = &def; theme.cb.box.tgl_pr = &tgl_pr;
theme.cb.box.ina = &def; theme.cb.box.ina = &def;
#endif #endif
} }
@@ -308,14 +377,12 @@ static void btnm_init(void)
static void kb_init(void) static void kb_init(void)
{ {
#if USE_LV_KB #if USE_LV_KB
theme.kb.bg = &bg;
theme.kb.btn.rel = &btn_rel;
theme.kb.bg = &def; theme.kb.btn.pr = &btn_pr;
theme.kb.btn.rel = &def; theme.kb.btn.tgl_rel = &btn_tgl_rel;
theme.kb.btn.pr = &def; theme.kb.btn.tgl_pr = &btn_tgl_pr;
theme.kb.btn.tgl_rel = &def; theme.kb.btn.ina = &btn_ina;
theme.kb.btn.tgl_pr = &def;
theme.kb.btn.ina = &def;
#endif #endif
} }
@@ -343,31 +410,26 @@ static void page_init(void)
{ {
#if USE_LV_PAGE #if USE_LV_PAGE
static lv_style_t page_scrl;
lv_style_copy(&page_scrl, &bg);
page_scrl.body.main_color = color_hsv_to_rgb(_hue, 10, 40);
page_scrl.body.grad_color = color_hsv_to_rgb(_hue, 10, 40);
page_scrl.body.border.color = COLOR_HEX3(0x333);
page_scrl.body.border.width = 1 << LV_AA;
page_scrl.body.radius = LV_DPI / 20;
theme.page.bg = &def;
theme.page.scrl = &def; theme.page.bg = &panel;
theme.page.sb = &def; theme.page.scrl = &page_scrl;
theme.page.sb = &sb;
#endif #endif
} }
static void ta_init(void) static void ta_init(void)
{ {
#if USE_LV_TA #if USE_LV_TA
theme.ta.area = &panel;
static lv_style_t list_ta; theme.ta.oneline = &panel;
lv_style_copy(&list_ta, &bg);
list_ta.body.main_color = color_hsv_to_rgb(_hue, 11, 18);
list_ta.body.grad_color = color_hsv_to_rgb(_hue, 11, 18);
list_ta.body.radius = LV_DPI / 30;
list_ta.body.border.color = color_hsv_to_rgb(_hue, 10, 10);
list_ta.body.border.width = 1 << LV_AA;
list_ta.body.border.opa = OPA_COVER;
list_ta.body.padding.ver = LV_DPI / 10;
list_ta.body.padding.hor = LV_DPI / 10;
theme.ta.area = &list_ta;
theme.ta.oneline = &list_ta;
theme.ta.cursor = NULL; theme.ta.cursor = NULL;
theme.ta.sb = &def; theme.ta.sb = &def;
#endif #endif
@@ -378,13 +440,7 @@ static void list_init(void)
#if USE_LV_LIST != 0 #if USE_LV_LIST != 0
static lv_style_t list_bg, list_btn_rel, list_btn_pr, list_btn_tgl_rel, list_btn_tgl_pr; static lv_style_t list_bg, list_btn_rel, list_btn_pr, list_btn_tgl_rel, list_btn_tgl_pr;
lv_style_copy(&list_bg, &bg); lv_style_copy(&list_bg, &panel);
list_bg.body.main_color = color_hsv_to_rgb(_hue, 11, 18);
list_bg.body.grad_color = color_hsv_to_rgb(_hue, 11, 18);
list_bg.body.radius = LV_DPI / 30;
list_bg.body.border.color = color_hsv_to_rgb(_hue, 10, 10);
list_bg.body.border.width = 1 << LV_AA;
list_bg.body.border.opa = OPA_COVER;
list_bg.body.padding.ver = 0; list_bg.body.padding.ver = 0;
list_bg.body.padding.hor = 0; list_bg.body.padding.hor = 0;
@@ -395,8 +451,8 @@ static void list_init(void)
list_btn_rel.body.border.width = 1 << LV_AA; list_btn_rel.body.border.width = 1 << LV_AA;
list_btn_rel.body.radius = LV_DPI / 10; list_btn_rel.body.radius = LV_DPI / 10;
list_btn_rel.text.color = color_hsv_to_rgb(_hue, 5, 80); list_btn_rel.text.color = color_hsv_to_rgb(_hue, 5, 80);
list_btn_rel.body.padding.ver = LV_DPI / 10; list_btn_rel.body.padding.ver = LV_DPI / 6;
list_btn_rel.body.padding.hor = LV_DPI / 10; list_btn_rel.body.padding.hor = LV_DPI / 8;
lv_style_copy(&list_btn_pr, &btn_pr); lv_style_copy(&list_btn_pr, &btn_pr);
list_btn_pr.body.main_color = btn_pr.body.grad_color; list_btn_pr.body.main_color = btn_pr.body.grad_color;
@@ -404,8 +460,8 @@ static void list_init(void)
list_btn_pr.body.border.color = color_hsv_to_rgb(_hue, 10, 5); list_btn_pr.body.border.color = color_hsv_to_rgb(_hue, 10, 5);
list_btn_pr.body.border.width = 0; list_btn_pr.body.border.width = 0;
list_btn_pr.body.radius = LV_DPI / 30; list_btn_pr.body.radius = LV_DPI / 30;
list_btn_pr.body.padding.ver = LV_DPI / 10; list_btn_pr.body.padding.ver = LV_DPI / 6;
list_btn_pr.body.padding.hor = LV_DPI / 10; list_btn_pr.body.padding.hor = LV_DPI / 8;
list_btn_pr.text.color = color_hsv_to_rgb(_hue, 5, 80); list_btn_pr.text.color = color_hsv_to_rgb(_hue, 5, 80);
lv_style_copy(&list_btn_tgl_rel, &list_btn_rel); lv_style_copy(&list_btn_tgl_rel, &list_btn_rel);
@@ -418,7 +474,7 @@ static void list_init(void)
list_btn_tgl_pr.body.main_color = btn_tgl_pr.body.main_color; list_btn_tgl_pr.body.main_color = btn_tgl_pr.body.main_color;
list_btn_tgl_pr.body.grad_color = btn_tgl_pr.body.grad_color; list_btn_tgl_pr.body.grad_color = btn_tgl_pr.body.grad_color;
theme.list.sb = &def; theme.list.sb = &sb;
theme.list.bg = &list_bg; theme.list.bg = &list_bg;
theme.list.scrl = &lv_style_transp_tight; theme.list.scrl = &lv_style_transp_tight;
theme.list.btn.rel = &list_btn_rel; theme.list.btn.rel = &list_btn_rel;
@@ -468,10 +524,7 @@ static void roller_init(void)
static void tabview_init(void) static void tabview_init(void)
{ {
#if USE_LV_TABVIEW != 0 #if USE_LV_TABVIEW != 0
theme.tabview.bg = &bg; theme.tabview.bg = &bg;
theme.tabview.sb = &def;
theme.tabview.indic = &lv_style_transp; theme.tabview.indic = &lv_style_transp;
theme.tabview.btn.bg = &lv_style_transp; theme.tabview.btn.bg = &lv_style_transp;
theme.tabview.btn.rel = &btn_rel; theme.tabview.btn.rel = &btn_rel;
@@ -487,12 +540,8 @@ static void win_init(void)
#if USE_LV_WIN != 0 #if USE_LV_WIN != 0
static lv_style_t win_bg; static lv_style_t win_bg;
lv_style_copy(&win_bg, &bg); lv_style_copy(&win_bg, &bg);
win_bg.body.main_color = color_hsv_to_rgb(_hue, 10, 60);
win_bg.body.grad_color = color_hsv_to_rgb(_hue, 10, 60);
win_bg.body.radius = LV_DPI / 20;
win_bg.body.border.color = COLOR_HEX3(0x333); win_bg.body.border.color = COLOR_HEX3(0x333);
win_bg.body.border.width = 1 << LV_AA; win_bg.body.border.width = 1 << LV_AA;
win_bg.body.border.width = 1 << LV_AA;
static lv_style_t win_header; static lv_style_t win_header;
lv_style_copy(&win_header, &win_bg); lv_style_copy(&win_header, &win_bg);
@@ -509,7 +558,7 @@ static void win_init(void)
win_btn_pr.body.grad_color = color_hsv_to_rgb(_hue, 10, 10); win_btn_pr.body.grad_color = color_hsv_to_rgb(_hue, 10, 10);
theme.win.bg = &win_bg; theme.win.bg = &win_bg;
theme.win.sb = &def; theme.win.sb = &sb;
theme.win.header = &win_header; theme.win.header = &win_header;
theme.win.content.bg = &lv_style_transp; theme.win.content.bg = &lv_style_transp;
theme.win.content.scrl = &lv_style_transp; theme.win.content.scrl = &lv_style_transp;
@@ -546,6 +595,7 @@ lv_theme_t * lv_theme_night_init(uint16_t hue, font_t *font)
} }
basic_init(); basic_init();
cont_init();
btn_init(); btn_init();
label_init(); label_init();
img_init(); img_init();

View File

@@ -53,6 +53,15 @@ static void basic_init(void)
} }
static void cont_init(void)
{
#if USE_LV_CONT != 0
theme.cont = &def;
#endif
}
static void btn_init(void) static void btn_init(void)
{ {
#if USE_LV_BTN != 0 #if USE_LV_BTN != 0
@@ -289,7 +298,6 @@ static void tabview_init(void)
theme.tabview.bg = &def; theme.tabview.bg = &def;
theme.tabview.sb = &def;
theme.tabview.indic = &def; theme.tabview.indic = &def;
theme.tabview.btn.bg = &def; theme.tabview.btn.bg = &def;
theme.tabview.btn.rel = &def; theme.tabview.btn.rel = &def;
@@ -343,6 +351,7 @@ lv_theme_t * lv_theme_templ_init(uint16_t hue, font_t *font)
} }
basic_init(); basic_init();
cont_init();
btn_init(); btn_init();
label_init(); label_init();
img_init(); img_init();
@@ -373,7 +382,7 @@ lv_theme_t * lv_theme_templ_init(uint16_t hue, font_t *font)
* Get a pointer to the theme * Get a pointer to the theme
* @return pointer to the theme * @return pointer to the theme
*/ */
lv_theme_t * lv_theme_get_deafult(void) lv_theme_t * lv_theme_get_templ(void)
{ {
return &theme; return &theme;
} }