From 086dac4444849a94bbeffa5842412bf5881e6113 Mon Sep 17 00:00:00 2001 From: Ajith P Venugopal Date: Wed, 12 Sep 2018 15:38:58 +0530 Subject: [PATCH 1/5] Ordered the colors and fixed the typo The color definitions are ordered according to the HTML color names (https://en.wikipedia.org/wiki/Web_colors). Fixed the typo of the color maroon --- lv_misc/lv_color.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lv_misc/lv_color.h b/lv_misc/lv_color.h index d0e0027b5..76ed4b49f 100644 --- a/lv_misc/lv_color.h +++ b/lv_misc/lv_color.h @@ -20,23 +20,23 @@ extern "C" { /********************* * DEFINES *********************/ -#define LV_COLOR_BLACK LV_COLOR_MAKE(0x00,0x00,0x00) #define LV_COLOR_WHITE LV_COLOR_MAKE(0xFF,0xFF,0xFF) -#define LV_COLOR_RED LV_COLOR_MAKE(0xFF,0x00,0x00) -#define LV_COLOR_LIME LV_COLOR_MAKE(0x00,0xFF,0x00) -#define LV_COLOR_BLUE LV_COLOR_MAKE(0x00,0x00,0xFF) -#define LV_COLOR_YELLOW LV_COLOR_MAKE(0xFF,0xFF,0x00) -#define LV_COLOR_CYAN LV_COLOR_MAKE(0x00,0xFF,0xFF) -#define LV_COLOR_AQUA LV_COLOR_CYAN -#define LV_COLOR_MAGENTA LV_COLOR_MAKE(0xFF,0x00,0xFF) #define LV_COLOR_SILVER LV_COLOR_MAKE(0xC0,0xC0,0xC0) #define LV_COLOR_GRAY LV_COLOR_MAKE(0x80,0x80,0x80) -#define LV_COLOR_MARRON LV_COLOR_MAKE(0x80,0x00,0x00) +#define LV_COLOR_BLACK LV_COLOR_MAKE(0x00,0x00,0x00) +#define LV_COLOR_RED LV_COLOR_MAKE(0xFF,0x00,0x00) +#define LV_COLOR_MAROON LV_COLOR_MAKE(0x80,0x00,0x00) +#define LV_COLOR_YELLOW LV_COLOR_MAKE(0xFF,0xFF,0x00) #define LV_COLOR_OLIVE LV_COLOR_MAKE(0x80,0x80,0x00) +#define LV_COLOR_LIME LV_COLOR_MAKE(0x00,0xFF,0x00) #define LV_COLOR_GREEN LV_COLOR_MAKE(0x00,0x80,0x00) -#define LV_COLOR_PURPLE LV_COLOR_MAKE(0x80,0x00,0x80) +#define LV_COLOR_CYAN LV_COLOR_MAKE(0x00,0xFF,0xFF) +#define LV_COLOR_AQUA LV_COLOR_CYAN #define LV_COLOR_TEAL LV_COLOR_MAKE(0x00,0x80,0x80) +#define LV_COLOR_BLUE LV_COLOR_MAKE(0x00,0x00,0xFF) #define LV_COLOR_NAVY LV_COLOR_MAKE(0x00,0x00,0x80) +#define LV_COLOR_MAGENTA LV_COLOR_MAKE(0xFF,0x00,0xFF) +#define LV_COLOR_PURPLE LV_COLOR_MAKE(0x80,0x00,0x80) #define LV_COLOR_ORANGE LV_COLOR_MAKE(0xFF,0xA5,0x00) #define LV_OPA_TRANSP 0 From 17d27821826531422a868da4ae18567c49a6a13d Mon Sep 17 00:00:00 2001 From: Ajith Date: Wed, 12 Sep 2018 18:02:08 +0530 Subject: [PATCH 2/5] added a new theme named nemo --- lv_themes/lv_theme.h | 1 + lv_themes/lv_theme_nemo.c | 755 ++++++++++++++++++++++++++++++++++++++ lv_themes/lv_theme_nemo.h | 56 +++ lv_themes/lv_themes.mk | 1 + 4 files changed, 813 insertions(+) create mode 100644 lv_themes/lv_theme_nemo.c create mode 100644 lv_themes/lv_theme_nemo.h diff --git a/lv_themes/lv_theme.h b/lv_themes/lv_theme.h index 22e7b2439..d20939cc2 100644 --- a/lv_themes/lv_theme.h +++ b/lv_themes/lv_theme.h @@ -260,6 +260,7 @@ lv_theme_t * lv_theme_get_current(void); #include "lv_theme_night.h" #include "lv_theme_zen.h" #include "lv_theme_mono.h" +#include "lv_theme_nemo.h" #ifdef __cplusplus } /* extern "C" */ diff --git a/lv_themes/lv_theme_nemo.c b/lv_themes/lv_theme_nemo.c new file mode 100644 index 000000000..c8488e71d --- /dev/null +++ b/lv_themes/lv_theme_nemo.c @@ -0,0 +1,755 @@ +/** + * @file lv_theme_nemo.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_theme.h" + + +#if USE_LV_THEME_NEMO + +/********************* + * DEFINES + *********************/ +#define DEF_RADIUS 4 +#define DEF_SHADOW_COLOR LV_COLOR_HEX3(0xaaa) + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +/********************** + * STATIC VARIABLES + **********************/ +static lv_theme_t theme; +static lv_style_t def; + +/*Static style definitions*/ +static lv_style_t sb; + +/*Saved input parameters*/ +static uint16_t _hue; +static lv_font_t * _font; + +/********************** + * MACROS + **********************/ + +/********************** + * STATIC FUNCTIONS + **********************/ + +static void basic_init(void) +{ + lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/ + def.text.font = _font; + def.body.radius = DEF_RADIUS; + + static lv_style_t bg, panel; + lv_style_copy(&bg, &def); + bg.body.main_color = LV_COLOR_HEX(0xf0f0f0); + bg.body.grad_color = bg.body.main_color; + bg.body.radius = 0; + + lv_style_copy(&panel, &def); + panel.body.radius = DEF_RADIUS; + panel.body.main_color = LV_COLOR_WHITE; + panel.body.grad_color = LV_COLOR_WHITE; + panel.body.border.width = 1; + panel.body.border.color = LV_COLOR_HEX3(0xbbb); + panel.body.border.opa = LV_OPA_COVER; + panel.body.shadow.color = DEF_SHADOW_COLOR; + panel.body.shadow.type = LV_SHADOW_BOTTOM; + panel.body.shadow.width = 4; + panel.body.padding.hor = LV_DPI / 8; + panel.body.padding.ver = LV_DPI / 8; + panel.body.padding.inner = LV_DPI / 12; + panel.text.color = LV_COLOR_HEX3(0x333); + + lv_style_copy(&sb, &def); + sb.body.main_color = LV_COLOR_BLACK; + sb.body.grad_color = LV_COLOR_BLACK; + sb.body.opa = LV_OPA_40; + + theme.bg = &bg; + theme.panel = &panel; + +} + +static void cont_init(void) +{ +#if USE_LV_CONT != 0 + + + theme.cont = theme.panel; +#endif +} + +static void btn_init(void) +{ +#if USE_LV_BTN != 0 + static lv_style_t rel, pr, tgl_rel, tgl_pr, ina; + + lv_style_copy(&rel, &def); + rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); + rel.body.grad_color = rel.body.main_color; + rel.body.radius = DEF_RADIUS; + rel.body.padding.hor = LV_DPI / 6; + rel.body.padding.ver = LV_DPI / 8; + rel.body.padding.inner = LV_DPI / 10; + rel.body.shadow.color = DEF_SHADOW_COLOR; + rel.body.shadow.type = LV_SHADOW_BOTTOM; + rel.body.shadow.width = 6; + rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + + + lv_style_copy(&pr, &rel); + pr.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 60); + pr.body.grad_color = pr.body.main_color; + pr.body.shadow.width = 4; + + lv_style_copy(&tgl_rel, &rel); + tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 50); + tgl_rel.body.grad_color = tgl_rel.body.main_color; + tgl_rel.body.shadow.width = 4; + + lv_style_copy(&tgl_pr, &tgl_rel); + tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 40); + tgl_pr.body.grad_color = tgl_pr.body.main_color; + tgl_pr.body.shadow.width = 2; + + lv_style_copy(&ina, &rel); + ina.body.main_color = LV_COLOR_HEX3(0xccc); + ina.body.grad_color = ina.body.main_color; + ina.body.shadow.width = 0; + ina.text.color = lv_color_hsv_to_rgb(_hue, 95, 5); + + theme.btn.rel = &rel; + theme.btn.pr = ≺ + theme.btn.tgl_rel = &tgl_rel; + theme.btn.tgl_pr = &tgl_pr; + theme.btn.ina = &ina; +#endif +} + + +static void label_init(void) +{ +#if USE_LV_LABEL != 0 + static lv_style_t prim, sec, hint; + + lv_style_copy(&prim, &def); + prim.text.font = _font; + prim.text.color = lv_color_hsv_to_rgb(_hue, 80, 10); + + lv_style_copy(&sec, &prim); + sec.text.color = lv_color_hsv_to_rgb(_hue, 80, 75); + + lv_style_copy(&hint, &prim); + hint.text.color = lv_color_hsv_to_rgb(_hue, 40, 90); + + theme.label.prim = &prim; + theme.label.sec = &sec; + theme.label.hint = &hint; +#endif +} + +static void img_init(void) +{ +#if USE_LV_IMG != 0 + static lv_style_t img_light, img_dark; + lv_style_copy(&img_light, &def); + img_light.image.color = lv_color_hsv_to_rgb(_hue, 15, 85); + img_light.image.intense = LV_OPA_80; + + lv_style_copy(&img_dark, &def); + img_light.image.color = lv_color_hsv_to_rgb(_hue, 85, 65); + img_light.image.intense = LV_OPA_80; + + + theme.img.light = &def; + theme.img.dark = &def; +#endif +} + +static void line_init(void) +{ +#if USE_LV_LINE != 0 + + + theme.line.decor = &def; +#endif +} + +static void led_init(void) +{ +#if USE_LV_LED != 0 + static lv_style_t led; + lv_style_copy(&led, &def); + led.body.shadow.width = LV_DPI / 10; + led.body.radius = LV_RADIUS_CIRCLE; + led.body.border.width= LV_DPI / 30; + led.body.border.opa = LV_OPA_30; + led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100); + led.body.grad_color = lv_color_hsv_to_rgb(_hue, 100, 100); + led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60); + led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 100, 100); + + + theme.led = &led; +#endif +} + +static void bar_init(void) +{ +#if USE_LV_BAR + static lv_style_t bar_bg, bar_indic; + + lv_style_copy(&bar_bg, &def); + bar_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 15, 95); + bar_bg.body.grad_color = bar_bg.body.main_color; + bar_bg.body.radius = 3; + bar_bg.body.border.width = 0; + bar_bg.body.padding.hor = LV_DPI / 12; + bar_bg.body.padding.ver = LV_DPI / 12; + + lv_style_copy(&bar_indic, &bar_bg); + bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 85, 70); + bar_indic.body.grad_color = bar_indic.body.main_color; + bar_indic.body.padding.hor = 0; + bar_indic.body.padding.ver = 0; + + theme.bar.bg = &bar_bg; + theme.bar.indic = &bar_indic; +#endif +} + +static void slider_init(void) +{ +#if USE_LV_SLIDER != 0 + static lv_style_t knob; + + lv_style_copy(&knob, &def); + knob.body.radius = LV_RADIUS_CIRCLE; + knob.body.border.width = 0; + knob.body.main_color = theme.bar.indic->body.main_color; + knob.body.grad_color = knob.body.main_color; + + theme.slider.bg = theme.bar.bg; + theme.slider.indic = theme.bar.indic; + theme.slider.knob = &knob; +#endif +} + +static void sw_init(void) +{ +#if USE_LV_SW != 0 + static lv_style_t sw_bg, sw_indic, sw_knob_off, sw_knob_on; + lv_style_copy(&sw_bg, theme.slider.bg); + sw_bg.body.radius = LV_RADIUS_CIRCLE; + + lv_style_copy(&sw_indic, theme.slider.bg); + sw_indic.body.radius = LV_RADIUS_CIRCLE; + + lv_style_copy(&sw_knob_on, theme.slider.knob); + sw_knob_on.body.shadow.width = 3; + sw_knob_on.body.shadow.type = LV_SHADOW_BOTTOM; + sw_knob_on.body.shadow.color = DEF_SHADOW_COLOR; + + + lv_style_copy(&sw_knob_off, &sw_knob_on); + sw_knob_off.body.main_color = LV_COLOR_HEX(0xfafafa); + sw_knob_off.body.grad_color = sw_knob_off.body.main_color; + sw_knob_off.body.border.width = 1; + sw_knob_off.body.border.color = LV_COLOR_HEX3(0x999); + sw_knob_off.body.border.opa = LV_OPA_COVER; + + theme.sw.bg = &sw_bg; + theme.sw.indic = &sw_indic; + theme.sw.knob_off = &sw_knob_off; + theme.sw.knob_on = &sw_knob_on; +#endif +} + + +static void lmeter_init(void) +{ +#if USE_LV_LMETER != 0 + static lv_style_t lmeter; + lv_style_copy(&lmeter, &def); + lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 90); + lmeter.body.grad_color = lmeter.body.main_color; + lmeter.body.padding.hor = LV_DPI / 10; /*Scale line length*/ + lmeter.line.color = LV_COLOR_HEX3(0x999); + lmeter.line.width = 3; + + theme.lmeter = &lmeter; +#endif +} + +static void gauge_init(void) +{ +#if USE_LV_GAUGE != 0 + + static lv_style_t gauge; + lv_style_copy(&gauge, &def); + gauge.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 60); + gauge.body.grad_color = gauge.body.main_color; + gauge.body.padding.hor = LV_DPI / 16; /*Scale line length*/ + gauge.body.padding.inner = LV_DPI / 8; + gauge.body.border.color = LV_COLOR_HEX3(0x999); + gauge.text.color = LV_COLOR_HEX3(0x333); + gauge.line.width = 3; + gauge.line.color = lv_color_hsv_to_rgb(_hue, 95, 70); + + theme.gauge = &gauge; +#endif +} + +static void chart_init(void) +{ +#if USE_LV_CHART + + + theme.chart = theme.panel; +#endif +} + +static void cb_init(void) +{ +#if USE_LV_CB != 0 + static lv_style_t rel, pr, tgl_rel, tgl_pr, ina; + lv_style_copy(&rel,theme.panel); + rel.body.shadow.type = LV_SHADOW_BOTTOM; + rel.body.shadow.width = 3; + + lv_style_copy(&pr, &rel); + pr.body.main_color = LV_COLOR_HEX3(0xccc); + pr.body.grad_color = pr.body.main_color; + pr.body.shadow.width = 0; + + lv_style_copy(&tgl_rel, &rel); + tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 85); + tgl_rel.body.grad_color = tgl_rel.body.main_color; + tgl_rel.body.shadow.type = LV_SHADOW_FULL; + tgl_rel.body.shadow.width = 0; + + lv_style_copy(&tgl_pr, &tgl_rel); + tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 65); + tgl_pr.body.grad_color = tgl_pr.body.main_color; + tgl_pr.body.shadow.width = 0; + + lv_style_copy(&ina, theme.btn.ina); + + theme.cb.bg = &lv_style_transp; + theme.cb.box.rel = &rel; + theme.cb.box.pr = ≺ + theme.cb.box.tgl_rel = &tgl_rel; + theme.cb.box.tgl_pr = &tgl_pr; + theme.cb.box.ina = &ina; +#endif +} + + +static void btnm_init(void) +{ +#if USE_LV_BTNM + static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina; + + lv_style_copy(&bg,theme.panel); + bg.body.padding.hor = 0; + bg.body.padding.ver = 0; + bg.body.padding.inner = 0; + bg.text.color = LV_COLOR_HEX3(0x555); + + lv_style_copy(&rel,theme.panel); + rel.body.border.part = LV_BORDER_RIGHT; + rel.body.border.width = 1; + rel.body.border.color = LV_COLOR_HEX3(0xbbb); + rel.body.empty = 1; + rel.body.shadow.width = 0; + + lv_style_copy(&pr, &rel); + pr.glass = 0; + pr.body.main_color = LV_COLOR_HEX3(0xddd); + pr.body.grad_color = pr.body.main_color; + pr.body.border.width = 0; + pr.body.empty = 0; + + lv_style_copy(&tgl_rel, &pr); + tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); + tgl_rel.body.grad_color = tgl_rel.body.main_color; + tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + + + lv_style_copy(&tgl_pr, &tgl_rel); + tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 65); + tgl_pr.body.grad_color = tgl_pr.body.main_color; + tgl_pr.body.border.width = 0; + + lv_style_copy(&ina, &pr); + ina.body.main_color = LV_COLOR_HEX3(0xccc); + ina.body.grad_color = ina.body.main_color; + + theme.btnm.bg = &bg; + theme.btnm.btn.rel = &rel; + theme.btnm.btn.pr = ≺ + theme.btnm.btn.tgl_rel = &tgl_rel; + theme.btnm.btn.tgl_pr = &tgl_pr; + theme.btnm.btn.ina = &def; +#endif +} + +static void kb_init(void) +{ +#if USE_LV_KB + + static lv_style_t rel; + lv_style_copy(&rel, &lv_style_transp); + rel.text.font = _font; + + theme.kb.bg = theme.btnm.bg; + theme.kb.btn.rel = &rel; + theme.kb.btn.pr = theme.btnm.btn.pr; + theme.kb.btn.tgl_rel = theme.btnm.btn.tgl_rel; + theme.kb.btn.tgl_pr = theme.btnm.btn.tgl_pr; + theme.kb.btn.ina = theme.btnm.btn.ina; +#endif + +} + +static void mbox_init(void) +{ +#if USE_LV_MBOX + static lv_style_t pr, rel; + + lv_style_copy(&rel, &lv_style_transp); + rel.glass = 0; + rel.text.font = _font; + rel.text.color = lv_color_hsv_to_rgb(_hue, 85, 75); + + lv_style_copy(&pr, theme.btnm.btn.pr); + pr.text.color = lv_color_hsv_to_rgb(_hue, 85, 60); + + theme.mbox.bg = theme.panel; + theme.mbox.btn.bg = &lv_style_transp; + theme.mbox.btn.rel = &rel; + theme.mbox.btn.pr = ≺ +#endif +} + +static void page_init(void) +{ +#if USE_LV_PAGE + + + theme.page.bg = theme.panel; + theme.page.scrl = &lv_style_transp; + theme.page.sb = &sb; +#endif +} + +static void ta_init(void) +{ +#if USE_LV_TA + static lv_style_t oneline; + + lv_style_copy(&oneline, &def); + oneline.body.empty = 1; + oneline.body.radius = 0; + oneline.body.border.part = LV_BORDER_BOTTOM; + oneline.body.border.width = 3; + oneline.body.border.color = LV_COLOR_HEX3(0x333); + oneline.body.border.opa = LV_OPA_COVER; + oneline.text.color = LV_COLOR_HEX3(0x333); + + theme.ta.area = theme.panel; + theme.ta.oneline = &oneline; + theme.ta.cursor = NULL; /*Let library to calculate the cursor's style*/ + theme.ta.sb = &sb; +#endif +} + +static void list_init(void) +{ +#if USE_LV_LIST != 0 + + static lv_style_t list_bg, rel, pr, tgl_rel, tgl_pr, ina; + + lv_style_copy(&list_bg, theme.panel); + list_bg.body.padding.hor = 0; + list_bg.body.padding.ver = 0; + list_bg.body.padding.inner = 0; + + lv_style_copy(&rel, &lv_style_transp); + rel.body.padding.hor = LV_DPI / 8; + rel.body.padding.ver = LV_DPI / 6; + rel.body.radius = 10; + rel.body.border.color = LV_COLOR_HEX3(0xbbb); + rel.body.border.width = 1; + rel.body.border.part = LV_BORDER_BOTTOM; + + lv_style_copy(&pr, &rel); + pr.glass = 0; + pr.body.main_color = LV_COLOR_HEX3(0xddd); + pr.body.grad_color = pr.body.main_color; + pr.body.border.width = 0; + pr.body.empty = 0; + pr.body.radius = DEF_RADIUS; + pr.text.font = _font; + + lv_style_copy(&tgl_rel, &pr); + tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); + tgl_rel.body.grad_color = tgl_rel.body.main_color; + tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + + + lv_style_copy(&tgl_pr, &tgl_rel); + tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 60); + tgl_pr.body.grad_color = tgl_pr.body.main_color; + tgl_pr.body.border.width = 0; + + lv_style_copy(&ina, &pr); + ina.body.main_color = LV_COLOR_HEX3(0xccc); + ina.body.grad_color = ina.body.main_color; + + + theme.list.sb = &sb; + theme.list.bg = &list_bg; + theme.list.scrl = &lv_style_transp_tight; + theme.list.btn.rel = &rel; + theme.list.btn.pr = ≺ + theme.list.btn.tgl_rel = &tgl_rel; + theme.list.btn.tgl_pr = &tgl_pr; + theme.list.btn.ina = &ina; +#endif +} + +static void ddlist_init(void) +{ +#if USE_LV_DDLIST != 0 + static lv_style_t bg, sel; + lv_style_copy(&bg, theme.panel); + bg.body.padding.hor = LV_DPI / 6; + bg.body.padding.ver = LV_DPI / 6; + bg.text.line_space = LV_DPI / 8; + + + lv_style_copy(&sel, &bg); + sel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); + sel.body.grad_color = sel.body.main_color; + sel.body.border.width = 0; + sel.body.shadow.width = 0; + sel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + + + theme.ddlist.bg = &bg; + theme.ddlist.sel = &sel; + theme.ddlist.sb = &sb; +#endif +} + +static void roller_init(void) +{ +#if USE_LV_ROLLER != 0 + static lv_style_t roller_bg, roller_sel; + + lv_style_copy(&roller_bg, &lv_style_transp); + roller_bg.body.padding.hor = LV_DPI / 6; + roller_bg.body.padding.ver = LV_DPI / 6; + roller_bg.text.line_space = LV_DPI / 8; + roller_bg.text.font = _font; + roller_bg.glass = 0; + + lv_style_copy(&roller_sel, &roller_bg); + roller_sel.text.color = lv_color_hsv_to_rgb(_hue, 90, 70); + + + theme.roller.bg = &roller_bg; + theme.roller.sel = &roller_sel; +#endif +} + +static void tabview_init(void) +{ +#if USE_LV_TABVIEW != 0 + static lv_style_t indic, btn_bg, rel, pr, tgl_rel, tgl_pr; + + lv_style_copy(&indic, &def); + indic.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); + indic.body.grad_color = indic.body.main_color; + indic.body.radius = 0; + indic.body.border.width = 0; + indic.body.padding.inner = LV_DPI / 20; + + lv_style_copy(&btn_bg, &def); + btn_bg.body.main_color = LV_COLOR_HEX3(0xccc); + btn_bg.body.grad_color = btn_bg.body.main_color; + btn_bg.body.radius = 0; + btn_bg.body.border.width = 1; + btn_bg.body.border.color = LV_COLOR_HEX3(0x888); + btn_bg.body.border.part = LV_BORDER_BOTTOM; + btn_bg.body.border.opa = LV_OPA_COVER; + btn_bg.body.shadow.width = 5; + btn_bg.body.shadow.color = DEF_SHADOW_COLOR; + btn_bg.body.shadow.type = LV_SHADOW_BOTTOM; + btn_bg.body.padding.inner = 0; + btn_bg.body.padding.hor = 0; + btn_bg.body.padding.ver = 0; + btn_bg.text.color = LV_COLOR_HEX3(0x333); + + + lv_style_copy(&rel, &lv_style_transp); + rel.body.padding.ver = LV_DPI / 8; + rel.text.font = _font; + + lv_style_copy(&pr, &def); + pr.body.main_color = LV_COLOR_HEX3(0xbbb); + pr.body.grad_color = pr.body.main_color; + pr.body.border.width = 0; + pr.body.empty = 0; + pr.body.radius = 0; + pr.body.border.width = 1; + pr.body.border.color = LV_COLOR_HEX3(0x888); + pr.body.border.part = LV_BORDER_BOTTOM; + pr.body.border.opa = LV_OPA_COVER; + pr.text.color = LV_COLOR_HEX3(0x111); + + lv_style_copy(&tgl_rel, &lv_style_transp); + tgl_rel.glass = 0; + tgl_rel.text.font = _font; + tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 90, 70); + + lv_style_copy(&tgl_pr, &def); + tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 15, 85); + tgl_pr.body.grad_color = tgl_pr.body.main_color; + tgl_pr.body.border.width = 0; + tgl_pr.body.empty = 0; + tgl_pr.body.radius = 0; + tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 90, 60); + + theme.tabview.bg = theme.bg; + theme.tabview.indic = &indic; + theme.tabview.btn.bg = &btn_bg; + theme.tabview.btn.rel = &rel; + theme.tabview.btn.pr = ≺ + theme.tabview.btn.tgl_rel = &tgl_rel; + theme.tabview.btn.tgl_pr = &tgl_pr; +#endif +} + + +static void win_init(void) +{ +#if USE_LV_WIN != 0 + static lv_style_t header, pr; + + lv_style_copy(&header, &def); + header.body.main_color = LV_COLOR_HEX3(0xccc); + header.body.grad_color = header.body.main_color; + header.body.radius = DEF_RADIUS; + header.body.border.width = 1; + header.body.border.color = LV_COLOR_HEX3(0xbbb); + header.body.border.part = LV_BORDER_BOTTOM; + header.body.border.opa = LV_OPA_COVER; + header.body.padding.inner = 0; + header.body.padding.hor = 0; + header.body.padding.ver = 0; + header.text.color = LV_COLOR_HEX3(0x333); + + lv_style_copy(&pr, &def); + pr.body.main_color = LV_COLOR_HEX3(0xbbb); + pr.body.grad_color = pr.body.main_color; + pr.body.border.width = 0; + pr.body.empty = 0; + pr.body.radius = 0; + pr.text.color = LV_COLOR_HEX3(0x111); + + + theme.win.bg = theme.panel; + theme.win.sb = &sb; + theme.win.header = &header; + theme.win.content.bg = &lv_style_transp; + theme.win.content.scrl = &lv_style_transp; + theme.win.btn.rel = &lv_style_transp; + theme.win.btn.pr = ≺ +#endif +} + +/********************** + * GLOBAL FUNCTIONS + **********************/ + + + +/** + * Initialize the nemo theme + * @param hue [0..360] hue value from HSV color space to define the theme's base color + * @param font pointer to a font (NULL to use the default) + * @return pointer to the initialized theme + */ +lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t *font) +{ + if(font == NULL) font = LV_FONT_DEFAULT; + + _hue = hue; + _font = font; + + /*For backward compatibility initialize all theme elements with a default style */ + uint16_t i; + lv_style_t **style_p = (lv_style_t**) &theme; + for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) { + *style_p = &def; + style_p++; + } + + basic_init(); + cont_init(); + btn_init(); + label_init(); + img_init(); + line_init(); + led_init(); + bar_init(); + slider_init(); + sw_init(); + lmeter_init(); + gauge_init(); + chart_init(); + cb_init(); + btnm_init(); + kb_init(); + mbox_init(); + page_init(); + ta_init(); + list_init(); + ddlist_init(); + roller_init(); + tabview_init(); + win_init(); + + return &theme; +} + +/** + * Get a pointer to the theme + * @return pointer to the theme + */ +lv_theme_t * lv_theme_get_nemo(void) +{ + return &theme; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +#endif + diff --git a/lv_themes/lv_theme_nemo.h b/lv_themes/lv_theme_nemo.h new file mode 100644 index 000000000..34c87a10c --- /dev/null +++ b/lv_themes/lv_theme_nemo.h @@ -0,0 +1,56 @@ +/** + * @file lv_theme_nemo.h + * + */ + +#ifndef LV_THEME_NEMO_H +#define LV_THEME_NEMO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../lv_conf.h" + +#if USE_LV_THEME_NEMO + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the material theme + * @param hue [0..360] hue value from HSV color space to define the theme's base color + * @param font pointer to a font (NULL to use the default) + * @return pointer to the initialized theme + */ +lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t *font); + +/** + * Get a pointer to the theme + * @return pointer to the theme + */ +lv_theme_t * lv_theme_get_nemo(void); + +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_THEME_NEMO_H*/ diff --git a/lv_themes/lv_themes.mk b/lv_themes/lv_themes.mk index 7e3b2a29c..454764afb 100644 --- a/lv_themes/lv_themes.mk +++ b/lv_themes/lv_themes.mk @@ -5,6 +5,7 @@ CSRCS += lv_theme_night.c CSRCS += lv_theme_templ.c CSRCS += lv_theme_zen.c CSRCS += lv_theme_material.c +CSRCS += lv_theme_nemo.c DEPPATH += --dep-path lvgl/lv_themes From 3d95d9a8ee7131b52e71c5ef50f7e861b9aba056 Mon Sep 17 00:00:00 2001 From: Ajith P Venugopal Date: Mon, 17 Sep 2018 16:35:41 +0530 Subject: [PATCH 3/5] Fixed typo and minor grammar mistakes on README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a88c8a99..d303d16f5 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Homepage: https://littlevgl.com ## Porting In the simplest case you need 5 things: -1. Call `lv_tick_inc(x)` every `x` millisecods in a Timer or Task (`x` should be between 1 and 10) +1. Call `lv_tick_inc(x)` every `x` milliseconds in a Timer or Task (`x` should be between 1 and 10) 2. Register a function which can **copy a pixel array** to an area of the screen. 3. Register a function which can **read an input device**. (E.g. touch pad) 4. Copy `lv_conf_templ.h` as `lv_conf.h` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`. @@ -43,7 +43,7 @@ Or check the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/ma ## Project set-up 1. **Clone** or [Download](https://littlevgl.com/download) the lvgl repository: `git clone https://github.com/littlevgl/lvgl.git` -2. **Create project** with your prefered IDE and add the *lvgl* folder +2. **Create project** with your preferred IDE and add the *lvgl* folder 3. Copy **lvgl/lv_conf_templ.h** as **lv_conf.h** next to the *lvgl* folder 4. In the lv_conf.h delete the first `#if 0` and its `#endif`. Leave the default configuration for the first try. 5. In your *main.c*: #include "lvgl/lvgl.h" @@ -55,12 +55,12 @@ Or check the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/ma 9. Compile the code and load it to your embedded hardware ## PC Simulator -If you don't have an embedded hardware you can test the graphics library in a PC simulator. The simulator uses [SDL2](https://www.libsdl.org/) library to emulate a display on your monitor and a touch pad with your mouse. +You can test the graphics library in a PC simulator, if you don't have an embedded hardware. The simulator uses [SDL2](https://www.libsdl.org/) library to emulate a display on your monitor and a touch pad with your mouse. There is a pre-configured PC project for **Eclipse CDT** in this repository: https://github.com/littlevgl/pc_simulator ## Related repositories -* PC simualtor: https://github.com/littlevgl/pc_simulator +* PC simulator: https://github.com/littlevgl/pc_simulator * Projects: https://github.com/littlevgl/lv_projects * Examples: https://github.com/littlevgl/lv_examples * Drivers: https://github.com/littlevgl/lv_drivers From 602332a97cae2b8408e6790491952693fd2f5b66 Mon Sep 17 00:00:00 2001 From: Ajith P Venugopal Date: Mon, 17 Sep 2018 17:12:11 +0530 Subject: [PATCH 4/5] Fixed minor typos on CONTRIBUTING.md --- docs/CONTRIBUTING.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e5ae3c8d2..0a61b2e33 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -22,13 +22,13 @@ Please, take a look at [CODE_OF_CONDUCT](https://github.com/littlevgl/lvgl/blob/ There are few **general rules** * We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) -* Be kind and respectful. Strating with "Hi" is always a good idea :) -* If somebedy helped you give a feedback. +* Be kind and respectful. Starting with "Hi" is always a good idea :) +* If somebody helped you give a feedback. * One issue should be about one topic. If you have other questions please open a new issue. * Always create an issue before creating a [Pull request](https://help.github.com/articles/about-pull-requests/) to discuss the idea first -* Create small, "digestable" Pull requests. +* Create small, "digestible" Pull requests. * Tell your remarks in a structured way. Use paragraphs and the [Markdown](https://guides.github.com/features/mastering-markdown/) support of GitHub. -* Be sure you are using the lates version (from `master` branch) +* Be sure you are using the latest version (from `master` branch) * Keep in mind LittlevGL should be and should remain: - usable on small MCUs as well (think about memory footprint) - compilable with "non-standard" tools like Arduino (no gcc specific options) @@ -43,12 +43,12 @@ If you found a **simple and straightforward bug** like: * anything else which can be fixed locally with a few lines of code * or defective documentation -then tell +then tell: * where you found the bug (which file/function/variable) * how can it cause problem -* what is your suggeseted solution if you have +* what is your suggested solution if you have -If you faced with **something more clomplex** like: +If you faced with **something more complex** like: * might be simple but you don't know its origin * affects a whole file, module or even the architecture * needs deeper discussion @@ -57,7 +57,7 @@ then please * tell what do you experience * tell what do you expect to happen * tell how to reproduce the issue -* provide a simlified code example (better if can be tested with copy-paste) +* provide a simplified code example (better if can be tested with copy-paste) * attache your lv_conf.h (if you feel it's important) * logs and long codes should be attached in a file (instead of copying into a comment) @@ -69,16 +69,16 @@ If you have a good and useful idea open issue to tell it! Please note the follow * Can you help in implementing it? Your suggestion can have 4 possible outcomes: -1. This feature is already exists. In this case you will learn how to achive your goal. +1. This feature is already exists. In this case you will learn how to achieve your goal. 2. You can simply realize it with the current functionality. 3. Although it's a new feature but it would break LittlevGL's platform independent and/or resource minimalist nature. 4. It's really a new feature which would be good to be in LittlevGL. Hurray! In a discussion we figure out the technical details and implementation options. With the knowledge of how to do it somebody can implement the new feature. Keep in mind if you wouldn't like to do the implementation there is no guarantee that it will be ready in the near future. -However if you would like to force it, take a look at this page: [Feature request service](http://www.gl.littlev.hu/services#feature) +However, if you would like to force it, take a look at this page: [Feature request service](http://www.gl.littlev.hu/services#feature) ## How to implement a feature? -In [docs/TODO_MINOR.md](https://github.com/littlevgl/lvgl/blob/master/docs/TODO_MINOR.md) and [docs/TODO_PATCH.md](https://github.com/littlevgl/lvgl/blob/master/docs/TODO_PATCH.md) you can see some ideas which are waiting for somebody to realize them! If want to deal with a feature from this files, please start an issue and discusse the details. +In [docs/TODO_MINOR.md](https://github.com/littlevgl/lvgl/blob/master/docs/TODO_MINOR.md) and [docs/TODO_PATCH.md](https://github.com/littlevgl/lvgl/blob/master/docs/TODO_PATCH.md) you can see some ideas which are waiting for somebody to realize them! If want to deal with a feature from these files, please start an issue and discuss the details. The new feature should be in a new branch. @@ -88,7 +88,7 @@ The new feature should be in a new branch. Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/littlevgl/lvgl/blob/master/lv_misc/lv_templ.h) ### Naming conventions -* Words are sparated by '_' +* Words are separated by '_' * In variable and function names use only lower case letters (e.g. *height_tmp*) * In enums and defines use only upper case letters (e.g. *e.g. MAX_LINE_NUM*) * Global names (API): @@ -100,13 +100,13 @@ Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/lv_misc/l * prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name` * always add a closing *..._t* * Abbreviations: - * Use abbreviations on public names only if they become longer then 32 characters - * Use only very straightforward (e.g. pos: position) or well established (e.g. pr: press) abbreviatons + * Use abbreviations on public names only if they become longer than 32 characters + * Use only very straightforward (e.g. pos: position) or well-established (e.g. pr: press) abbreviations ### Coding guide * Functions: - * Try to write function shorter then is 50 lines - * Always shorter then 100 lines (except very straightforwards) + * Try to write function shorter than is 50 lines + * Always shorter than 100 lines (except very straightforwards) * Variables: * One line, one declaration (BAD: char x, y;) * Use `` (*uint8_t*, *int32_t* etc) @@ -138,7 +138,7 @@ You should write **why** have you done this: Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/` -In comments use \` \` when refering to a variable. E.g. ``/*Update the value of `x_act`*/`` +In comments use \` \` when referring to a variable. E.g. ``/*Update the value of `x_act`*/`` ### Formatting Here is example to show bracket placing and using of white spaces: @@ -149,7 +149,7 @@ Here is example to show bracket placing and using of white spaces: * @param text '\0' terminated character string. NULL to refresh with the current text. */ void lv_label_set_text(lv_obj_t * label, const char * text) -{ /* Main bracket of functions in new line*/ +{ /* Main brackets of functions in new line*/ if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/ From b5806968cba968bd403a09dcdd5f6eab753ffae5 Mon Sep 17 00:00:00 2001 From: Ajith Date: Mon, 17 Sep 2018 18:47:19 +0530 Subject: [PATCH 5/5] added a new theme based on 'finding nemo' movie --- lv_themes/lv_theme_nemo.c | 860 +++++++++++++++++++------------------- 1 file changed, 433 insertions(+), 427 deletions(-) diff --git a/lv_themes/lv_theme_nemo.c b/lv_themes/lv_theme_nemo.c index c8488e71d..c39e69920 100644 --- a/lv_themes/lv_theme_nemo.c +++ b/lv_themes/lv_theme_nemo.c @@ -14,8 +14,6 @@ /********************* * DEFINES *********************/ -#define DEF_RADIUS 4 -#define DEF_SHADOW_COLOR LV_COLOR_HEX3(0xaaa) /********************** * TYPEDEFS @@ -28,15 +26,39 @@ /********************** * STATIC VARIABLES **********************/ -static lv_theme_t theme; -static lv_style_t def; -/*Static style definitions*/ -static lv_style_t sb; - -/*Saved input parameters*/ static uint16_t _hue; static lv_font_t * _font; +static lv_font_t * _font; +static lv_font_t * _font; + +static lv_theme_t theme; +static lv_style_t def; +static lv_style_t bg; +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; + +#if USE_LV_BAR +static lv_style_t bar_bg, bar_indic; +#endif + +#if USE_LV_SLIDER +static lv_style_t slider_knob; +#endif + +#if USE_LV_LMETER +static lv_style_t lmeter_bg; +#endif + +#if USE_LV_DDLIST +static lv_style_t ddlist_bg, ddlist_sel; +#endif + +#if USE_LV_BTNM +static lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_trel, btnm_ina; +#endif + /********************** * MACROS @@ -48,94 +70,129 @@ static lv_font_t * _font; static void basic_init(void) { - lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/ + /*Default*/ + lv_style_copy(&def, &lv_style_plain); + def.body.opa = LV_OPA_COVER; + def.glass = 0; + + def.body.empty = 0; + def.body.main_color = LV_COLOR_HEX3(0x222); + def.body.grad_color = LV_COLOR_HEX3(0x222); + def.body.radius = 0; + def.body.padding.hor = LV_DPI / 8; + def.body.padding.ver = LV_DPI / 8; + def.body.padding.inner = LV_DPI / 8; + def.body.border.color = LV_COLOR_SILVER; + def.body.border.width = 1; + def.body.border.opa = LV_OPA_COVER; + def.body.shadow.color = LV_COLOR_SILVER; + def.body.shadow.width = 0; + def.body.shadow.type = LV_SHADOW_FULL; + + def.text.color = LV_COLOR_HEX3(0xDDD); def.text.font = _font; - def.body.radius = DEF_RADIUS; + def.text.letter_space = 1; + def.text.line_space = 2; - static lv_style_t bg, panel; + def.image.color = LV_COLOR_HEX3(0xDDD); + def.image.intense = LV_OPA_TRANSP; + + def.line.color = LV_COLOR_HEX3(0xDDD); + def.line.width = 1; + + /*Background*/ lv_style_copy(&bg, &def); - bg.body.main_color = LV_COLOR_HEX(0xf0f0f0); - bg.body.grad_color = bg.body.main_color; - bg.body.radius = 0; + bg.body.main_color = LV_COLOR_HEX3(0x005); + bg.body.grad_color = LV_COLOR_HEX3(0x045); + bg.body.border.width = 2; + bg.body.border.color = LV_COLOR_HEX3(0x666); + bg.body.shadow.color = LV_COLOR_SILVER; + /*Panel*/ lv_style_copy(&panel, &def); - panel.body.radius = DEF_RADIUS; - panel.body.main_color = LV_COLOR_WHITE; - panel.body.grad_color = LV_COLOR_WHITE; - panel.body.border.width = 1; - panel.body.border.color = LV_COLOR_HEX3(0xbbb); - panel.body.border.opa = LV_OPA_COVER; - panel.body.shadow.color = DEF_SHADOW_COLOR; - panel.body.shadow.type = LV_SHADOW_BOTTOM; - panel.body.shadow.width = 4; - panel.body.padding.hor = LV_DPI / 8; - panel.body.padding.ver = LV_DPI / 8; - panel.body.padding.inner = LV_DPI / 12; - panel.text.color = LV_COLOR_HEX3(0x333); + panel.body.radius = LV_DPI / 10; + panel.body.main_color = LV_COLOR_HEX3(0x500); + panel.body.grad_color = LV_COLOR_HEX3(0x505); + panel.body.border.color = LV_COLOR_HEX3(0xccc); + panel.body.border.width = 2; + panel.body.border.opa = LV_OPA_60; + panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); + panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 70); + /*Scrollbar*/ lv_style_copy(&sb, &def); - sb.body.main_color = LV_COLOR_BLACK; - sb.body.grad_color = LV_COLOR_BLACK; - sb.body.opa = LV_OPA_40; + sb.body.opa = LV_OPA_50; + sb.body.radius = LV_RADIUS_CIRCLE; + sb.body.border.color = LV_COLOR_SILVER; + sb.body.border.opa = LV_OPA_40; + sb.body.border.width = 1; + sb.body.main_color = lv_color_hsv_to_rgb(_hue, 33, 92); + sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 33, 92); + sb.body.padding.hor = 1; + sb.body.padding.ver = 1; + sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/ theme.bg = &bg; theme.panel = &panel; } -static void cont_init(void) -{ -#if USE_LV_CONT != 0 - - - theme.cont = theme.panel; -#endif -} - static void btn_init(void) { #if USE_LV_BTN != 0 - static lv_style_t rel, pr, tgl_rel, tgl_pr, ina; + lv_style_copy(&btn_rel, &def); + btn_rel.glass = 0; + btn_rel.body.empty = 1; + btn_rel.body.radius = LV_RADIUS_CIRCLE; + btn_rel.body.border.width = 2; + btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 70, 90); + btn_rel.body.border.opa = LV_OPA_80; + btn_rel.body.padding.hor = LV_DPI / 4; + btn_rel.body.padding.ver = LV_DPI / 6; + btn_rel.body.padding.inner = LV_DPI / 10; + btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); + btn_rel.text.font = _font; - lv_style_copy(&rel, &def); - rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); - rel.body.grad_color = rel.body.main_color; - rel.body.radius = DEF_RADIUS; - rel.body.padding.hor = LV_DPI / 6; - rel.body.padding.ver = LV_DPI / 8; - rel.body.padding.inner = LV_DPI / 10; - rel.body.shadow.color = DEF_SHADOW_COLOR; - rel.body.shadow.type = LV_SHADOW_BOTTOM; - rel.body.shadow.width = 6; - rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + lv_style_copy(&btn_pr, &btn_rel); + btn_pr.body.opa = LV_OPA_COVER; + btn_pr.body.empty = 0; + btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 50); + btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 50); + btn_pr.body.border.opa = LV_OPA_60; + btn_pr.text.font = _font; + btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 10, 100); + lv_style_copy(&btn_trel, &btn_pr); + btn_trel.body.opa = LV_OPA_COVER; + btn_trel.body.empty = 0; + btn_trel.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 60); + btn_trel.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 60); + btn_trel.body.border.opa = LV_OPA_60; + btn_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 90); + btn_trel.text.font = _font; + btn_trel.text.color = lv_color_hsv_to_rgb(_hue, 0, 100); - lv_style_copy(&pr, &rel); - pr.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 60); - pr.body.grad_color = pr.body.main_color; - pr.body.shadow.width = 4; + lv_style_copy(&btn_tpr, &btn_trel); + btn_tpr.body.opa = LV_OPA_COVER; + btn_tpr.body.empty = 0; + btn_tpr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 50); + btn_tpr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 50); + btn_tpr.body.border.opa = LV_OPA_60; + btn_tpr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 70); + btn_tpr.text.font = _font; + btn_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); - lv_style_copy(&tgl_rel, &rel); - tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 50); - tgl_rel.body.grad_color = tgl_rel.body.main_color; - tgl_rel.body.shadow.width = 4; + lv_style_copy(&btn_ina, &btn_rel); + btn_ina.body.border.opa = LV_OPA_60; + btn_ina.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 50); + btn_ina.text.font = _font; + btn_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); - lv_style_copy(&tgl_pr, &tgl_rel); - tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 40); - tgl_pr.body.grad_color = tgl_pr.body.main_color; - tgl_pr.body.shadow.width = 2; - - lv_style_copy(&ina, &rel); - ina.body.main_color = LV_COLOR_HEX3(0xccc); - ina.body.grad_color = ina.body.main_color; - ina.body.shadow.width = 0; - ina.text.color = lv_color_hsv_to_rgb(_hue, 95, 5); - - theme.btn.rel = &rel; - theme.btn.pr = ≺ - theme.btn.tgl_rel = &tgl_rel; - theme.btn.tgl_pr = &tgl_pr; - theme.btn.ina = &ina; + theme.btn.rel = &btn_rel; + theme.btn.pr = &btn_pr; + theme.btn.tgl_rel = &btn_trel; + theme.btn.tgl_pr = &btn_tpr; + theme.btn.ina = &btn_ina; #endif } @@ -143,21 +200,54 @@ static void btn_init(void) static void label_init(void) { #if USE_LV_LABEL != 0 - static lv_style_t prim, sec, hint; + static lv_style_t label_prim, label_sec, label_hint; - lv_style_copy(&prim, &def); - prim.text.font = _font; - prim.text.color = lv_color_hsv_to_rgb(_hue, 80, 10); + lv_style_copy(&label_prim, &def); + label_prim.text.font = _font; + label_prim.text.color = lv_color_hsv_to_rgb(_hue, 80, 96); - lv_style_copy(&sec, &prim); - sec.text.color = lv_color_hsv_to_rgb(_hue, 80, 75); + lv_style_copy(&label_sec, &label_prim); + label_sec.text.color = lv_color_hsv_to_rgb(_hue, 40, 85); - lv_style_copy(&hint, &prim); - hint.text.color = lv_color_hsv_to_rgb(_hue, 40, 90); + lv_style_copy(&label_hint, &label_prim); + label_hint.text.color = lv_color_hsv_to_rgb(_hue, 20, 70); - theme.label.prim = &prim; - theme.label.sec = &sec; - theme.label.hint = &hint; + theme.label.prim = &label_prim; + theme.label.sec = &label_sec; + theme.label.hint = &label_hint; +#endif +} + + +static void bar_init(void) +{ +#if USE_LV_BAR + lv_style_copy(&bar_bg, &def); + bar_bg.body.opa = LV_OPA_30; + bar_bg.body.radius = LV_RADIUS_CIRCLE; + bar_bg.body.main_color = LV_COLOR_WHITE; + bar_bg.body.grad_color = LV_COLOR_SILVER; + bar_bg.body.border.width = 2; + bar_bg.body.border.color = LV_COLOR_SILVER; + bar_bg.body.border.opa = LV_OPA_20; + bar_bg.body.padding.hor = 0; + bar_bg.body.padding.ver = LV_DPI / 10; + bar_bg.body.padding.inner = 0; + + lv_style_copy(&bar_indic, &def); + bar_indic.body.radius = LV_RADIUS_CIRCLE; + bar_indic.body.border.width = 2; + bar_indic.body.border.color = LV_COLOR_SILVER; + bar_indic.body.border.opa = LV_OPA_70; + bar_indic.body.padding.hor = 0; + bar_indic.body.padding.ver = 0; + bar_indic.body.shadow.width = LV_DPI / 20; + bar_indic.body.shadow.color = lv_color_hsv_to_rgb(_hue, 20, 90); + bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 80); + bar_indic.body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 80); + + theme.bar.bg = &bar_bg; + theme.bar.indic = &bar_indic; #endif } @@ -173,18 +263,20 @@ static void img_init(void) img_light.image.color = lv_color_hsv_to_rgb(_hue, 85, 65); img_light.image.intense = LV_OPA_80; - - theme.img.light = &def; - theme.img.dark = &def; + theme.img.light = &img_light; + theme.img.dark = &img_dark; #endif } static void line_init(void) { #if USE_LV_LINE != 0 + static lv_style_t line_decor; + lv_style_copy(&line_decor, &def); + line_decor.line.color = lv_color_hsv_to_rgb(_hue, 50, 50); + line_decor.line.width = 1; - - theme.line.decor = &def; + theme.line.decor = &line_decor; #endif } @@ -192,89 +284,63 @@ static void led_init(void) { #if USE_LV_LED != 0 static lv_style_t led; - lv_style_copy(&led, &def); + 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 = LV_OPA_30; led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100); - led.body.grad_color = lv_color_hsv_to_rgb(_hue, 100, 100); + led.body.grad_color = lv_color_hsv_to_rgb(_hue, 100, 40); led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60); led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 100, 100); - theme.led = &led; #endif } -static void bar_init(void) -{ -#if USE_LV_BAR - static lv_style_t bar_bg, bar_indic; - - lv_style_copy(&bar_bg, &def); - bar_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 15, 95); - bar_bg.body.grad_color = bar_bg.body.main_color; - bar_bg.body.radius = 3; - bar_bg.body.border.width = 0; - bar_bg.body.padding.hor = LV_DPI / 12; - bar_bg.body.padding.ver = LV_DPI / 12; - - lv_style_copy(&bar_indic, &bar_bg); - bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 85, 70); - bar_indic.body.grad_color = bar_indic.body.main_color; - bar_indic.body.padding.hor = 0; - bar_indic.body.padding.ver = 0; - - theme.bar.bg = &bar_bg; - theme.bar.indic = &bar_indic; -#endif -} - static void slider_init(void) { #if USE_LV_SLIDER != 0 - static lv_style_t knob; + lv_style_copy(&slider_knob, &def); + slider_knob.body.opa = LV_OPA_60; + slider_knob.body.radius = LV_RADIUS_CIRCLE; + slider_knob.body.main_color = LV_COLOR_PURPLE; + slider_knob.body.grad_color = LV_COLOR_SILVER; + slider_knob.body.border.width = 2; + slider_knob.body.border.color = LV_COLOR_ORANGE; + slider_knob.body.border.opa = LV_OPA_50; - lv_style_copy(&knob, &def); - knob.body.radius = LV_RADIUS_CIRCLE; - knob.body.border.width = 0; - knob.body.main_color = theme.bar.indic->body.main_color; - knob.body.grad_color = knob.body.main_color; - - theme.slider.bg = theme.bar.bg; - theme.slider.indic = theme.bar.indic; - theme.slider.knob = &knob; + theme.slider.bg = &bar_bg; + theme.slider.indic = &bar_indic; + theme.slider.knob = &slider_knob; #endif } static void sw_init(void) { #if USE_LV_SW != 0 - static lv_style_t sw_bg, sw_indic, sw_knob_off, sw_knob_on; - lv_style_copy(&sw_bg, theme.slider.bg); - sw_bg.body.radius = LV_RADIUS_CIRCLE; + static lv_style_t sw_bg, sw_indic, sw_knob; + lv_style_copy(&sw_bg, &bar_bg); + sw_bg.body.opa = LV_OPA_COVER; + sw_bg.body.padding.ver = -2 ; + sw_bg.body.padding.hor = -2 ; + sw_bg.body.main_color = LV_COLOR_HEX3(0x666); + sw_bg.body.grad_color = LV_COLOR_HEX3(0x999); + sw_bg.body.border.width = 2; + sw_bg.body.border.opa = LV_OPA_50; - lv_style_copy(&sw_indic, theme.slider.bg); - sw_indic.body.radius = LV_RADIUS_CIRCLE; + lv_style_copy(&sw_indic, &bar_indic); + sw_indic.body.shadow .width = LV_DPI / 20; + sw_indic.body.padding.ver = 0; + sw_indic.body.padding.hor = 0; - lv_style_copy(&sw_knob_on, theme.slider.knob); - sw_knob_on.body.shadow.width = 3; - sw_knob_on.body.shadow.type = LV_SHADOW_BOTTOM; - sw_knob_on.body.shadow.color = DEF_SHADOW_COLOR; - - - lv_style_copy(&sw_knob_off, &sw_knob_on); - sw_knob_off.body.main_color = LV_COLOR_HEX(0xfafafa); - sw_knob_off.body.grad_color = sw_knob_off.body.main_color; - sw_knob_off.body.border.width = 1; - sw_knob_off.body.border.color = LV_COLOR_HEX3(0x999); - sw_knob_off.body.border.opa = LV_OPA_COVER; + lv_style_copy(&sw_knob, &slider_knob); + sw_knob.body.opa = LV_OPA_80; theme.sw.bg = &sw_bg; theme.sw.indic = &sw_indic; - theme.sw.knob_off = &sw_knob_off; - theme.sw.knob_on = &sw_knob_on; + theme.sw.knob_off = &sw_knob; + theme.sw.knob_on = &sw_knob; #endif } @@ -282,78 +348,93 @@ static void sw_init(void) static void lmeter_init(void) { #if USE_LV_LMETER != 0 - static lv_style_t lmeter; - lv_style_copy(&lmeter, &def); - lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 90); - lmeter.body.grad_color = lmeter.body.main_color; - lmeter.body.padding.hor = LV_DPI / 10; /*Scale line length*/ - lmeter.line.color = LV_COLOR_HEX3(0x999); - lmeter.line.width = 3; + lv_style_copy(&lmeter_bg, &def); + lmeter_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 70); + lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 80); + lmeter_bg.body.padding.hor = LV_DPI / 8; /*Scale line length*/ + lmeter_bg.line.color = LV_COLOR_HEX3(0x500); + lmeter_bg.line.width = 2; + + theme.lmeter = &lmeter_bg; - theme.lmeter = &lmeter; #endif } static void gauge_init(void) { #if USE_LV_GAUGE != 0 + static lv_style_t gauge_bg; + lv_style_copy(&gauge_bg, &def); + gauge_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 20, 100); + gauge_bg.body.grad_color = gauge_bg.body.main_color; + gauge_bg.body.padding.hor = LV_DPI / 16; /*Scale line length*/ + gauge_bg.body.padding.ver = LV_DPI / 20; /*Needle center size*/ + gauge_bg.body.padding.inner = LV_DPI / 12; /*Label - scale distance*/ + gauge_bg.body.border.color = LV_COLOR_HEX3(0x500); + gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75); + gauge_bg.line.width = 2; + gauge_bg.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); + gauge_bg.text.font = _font; - static lv_style_t gauge; - lv_style_copy(&gauge, &def); - gauge.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 60); - gauge.body.grad_color = gauge.body.main_color; - gauge.body.padding.hor = LV_DPI / 16; /*Scale line length*/ - gauge.body.padding.inner = LV_DPI / 8; - gauge.body.border.color = LV_COLOR_HEX3(0x999); - gauge.text.color = LV_COLOR_HEX3(0x333); - gauge.line.width = 3; - gauge.line.color = lv_color_hsv_to_rgb(_hue, 95, 70); - - theme.gauge = &gauge; + theme.gauge = &gauge_bg; #endif } static void chart_init(void) { #if USE_LV_CHART - - - theme.chart = theme.panel; + theme.chart = &panel; #endif } static void cb_init(void) { #if USE_LV_CB != 0 - static lv_style_t rel, pr, tgl_rel, tgl_pr, ina; - lv_style_copy(&rel,theme.panel); - rel.body.shadow.type = LV_SHADOW_BOTTOM; - rel.body.shadow.width = 3; + static lv_style_t cb_bg, cb_rel, cb_pr, cb_trel, cb_tpr, cb_ina; + lv_style_copy(&cb_rel, &bg); + cb_rel.body.radius = LV_DPI / 20; + cb_rel.body.border.width = 1; + cb_rel.body.border.color = LV_COLOR_ORANGE; + cb_rel.body.main_color = LV_COLOR_PURPLE; + cb_rel.body.grad_color = LV_COLOR_SILVER; - lv_style_copy(&pr, &rel); - pr.body.main_color = LV_COLOR_HEX3(0xccc); - pr.body.grad_color = pr.body.main_color; - pr.body.shadow.width = 0; + lv_style_copy(&cb_bg, &bg); + cb_bg.body.empty = 1; + cb_bg.body.border.width = 0; + cb_bg.body.padding.inner = LV_DPI / 8; + cb_bg.body.padding.hor = 0; + cb_bg.body.padding.ver = 0; + cb_bg.text.font = _font; - lv_style_copy(&tgl_rel, &rel); - tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 85); - tgl_rel.body.grad_color = tgl_rel.body.main_color; - tgl_rel.body.shadow.type = LV_SHADOW_FULL; - tgl_rel.body.shadow.width = 0; + lv_style_copy(&cb_pr, &cb_rel); + cb_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 90); + cb_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 82); - lv_style_copy(&tgl_pr, &tgl_rel); - tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 65); - tgl_pr.body.grad_color = tgl_pr.body.main_color; - tgl_pr.body.shadow.width = 0; + lv_style_copy(&cb_trel, &cb_rel); + cb_trel.body.border.width = 4; + cb_trel.body.border.color = LV_COLOR_WHITE; + cb_trel.body.border.opa = LV_OPA_60; + cb_trel.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 82); + cb_trel.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 62); - lv_style_copy(&ina, theme.btn.ina); + lv_style_copy(&cb_tpr, &cb_trel); + cb_tpr.body.border.color = LV_COLOR_SILVER; + cb_tpr.body.border.opa = LV_OPA_70; + cb_tpr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 72); + cb_tpr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 52); - theme.cb.bg = &lv_style_transp; - theme.cb.box.rel = &rel; - theme.cb.box.pr = ≺ - theme.cb.box.tgl_rel = &tgl_rel; - theme.cb.box.tgl_pr = &tgl_pr; - theme.cb.box.ina = &ina; + lv_style_copy(&cb_ina, &cb_trel); + cb_ina.body.border.width = 1; + cb_ina.body.border.color = LV_COLOR_GRAY; + cb_ina.body.main_color = LV_COLOR_PURPLE; + cb_ina.body.grad_color = LV_COLOR_SILVER; + + theme.cb.bg = &cb_bg; + theme.cb.box.rel = &cb_rel; + theme.cb.box.pr = &cb_pr; + theme.cb.box.tgl_rel = &cb_trel; + theme.cb.box.tgl_pr = &cb_tpr; + theme.cb.box.ina = &cb_ina; #endif } @@ -361,66 +442,50 @@ static void cb_init(void) static void btnm_init(void) { #if USE_LV_BTNM - static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina; + lv_style_copy(&btnm_bg, &lv_style_transp_tight); + btnm_bg.body.border.width = 1; + btnm_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 80); + btnm_bg.body.border.opa = LV_OPA_COVER; + btnm_bg.body.radius = LV_DPI / 8; - lv_style_copy(&bg,theme.panel); - bg.body.padding.hor = 0; - bg.body.padding.ver = 0; - bg.body.padding.inner = 0; - bg.text.color = LV_COLOR_HEX3(0x555); + lv_style_copy(&btnm_rel, &lv_style_plain); + btnm_rel.body.empty = 1; + btnm_rel.body.radius = LV_DPI / 8; + btnm_rel.text.color = lv_color_hsv_to_rgb(_hue, 60, 80); + btnm_rel.text.font = _font; - lv_style_copy(&rel,theme.panel); - rel.body.border.part = LV_BORDER_RIGHT; - rel.body.border.width = 1; - rel.body.border.color = LV_COLOR_HEX3(0xbbb); - rel.body.empty = 1; - rel.body.shadow.width = 0; + lv_style_copy(&btnm_pr, &lv_style_plain); + btnm_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 70); + btnm_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 70); + btnm_pr.body.radius = LV_DPI / 8; + btnm_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 40); + btnm_pr.text.font = _font; - lv_style_copy(&pr, &rel); - pr.glass = 0; - pr.body.main_color = LV_COLOR_HEX3(0xddd); - pr.body.grad_color = pr.body.main_color; - pr.body.border.width = 0; - pr.body.empty = 0; + lv_style_copy(&btnm_trel, &btnm_rel); + btnm_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 80); + btnm_trel.body.border.width = 3; - lv_style_copy(&tgl_rel, &pr); - tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); - tgl_rel.body.grad_color = tgl_rel.body.main_color; - tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + lv_style_copy(&btnm_ina, &btnm_rel); + btnm_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 60); - - lv_style_copy(&tgl_pr, &tgl_rel); - tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 65); - tgl_pr.body.grad_color = tgl_pr.body.main_color; - tgl_pr.body.border.width = 0; - - lv_style_copy(&ina, &pr); - ina.body.main_color = LV_COLOR_HEX3(0xccc); - ina.body.grad_color = ina.body.main_color; - - theme.btnm.bg = &bg; - theme.btnm.btn.rel = &rel; - theme.btnm.btn.pr = ≺ - theme.btnm.btn.tgl_rel = &tgl_rel; - theme.btnm.btn.tgl_pr = &tgl_pr; - theme.btnm.btn.ina = &def; + theme.btnm.bg = &btnm_bg; + theme.btnm.btn.rel = &btnm_rel; + theme.btnm.btn.pr = &btnm_pr; + theme.btnm.btn.tgl_rel = &btnm_trel; + theme.btnm.btn.tgl_pr = &btnm_pr; + theme.btnm.btn.ina = &btnm_ina; #endif } static void kb_init(void) { #if USE_LV_KB - - static lv_style_t rel; - lv_style_copy(&rel, &lv_style_transp); - rel.text.font = _font; - - theme.kb.bg = theme.btnm.bg; - theme.kb.btn.rel = &rel; - theme.kb.btn.pr = theme.btnm.btn.pr; - theme.kb.btn.tgl_rel = theme.btnm.btn.tgl_rel; - theme.kb.btn.tgl_pr = theme.btnm.btn.tgl_pr; - theme.kb.btn.ina = theme.btnm.btn.ina; + theme.kb.bg = &btnm_bg; + theme.kb.btn.rel = &btnm_rel; + theme.kb.btn.pr = &btnm_pr; + theme.kb.btn.tgl_rel = &btnm_trel; + theme.kb.btn.tgl_pr = &btnm_pr; + theme.kb.btn.ina = &btnm_ina; #endif } @@ -428,30 +493,22 @@ static void kb_init(void) static void mbox_init(void) { #if USE_LV_MBOX - static lv_style_t pr, rel; + static lv_style_t mbox_bg; + lv_style_copy(&mbox_bg, &panel); + mbox_bg.body.shadow.width = LV_DPI / 12; - lv_style_copy(&rel, &lv_style_transp); - rel.glass = 0; - rel.text.font = _font; - rel.text.color = lv_color_hsv_to_rgb(_hue, 85, 75); - - lv_style_copy(&pr, theme.btnm.btn.pr); - pr.text.color = lv_color_hsv_to_rgb(_hue, 85, 60); - - theme.mbox.bg = theme.panel; + theme.mbox.bg = &mbox_bg; theme.mbox.btn.bg = &lv_style_transp; - theme.mbox.btn.rel = &rel; - theme.mbox.btn.pr = ≺ + theme.mbox.btn.rel = &btn_trel; + theme.mbox.btn.pr = &btn_tpr; #endif } static void page_init(void) { #if USE_LV_PAGE - - - theme.page.bg = theme.panel; - theme.page.scrl = &lv_style_transp; + theme.page.bg = &panel; + theme.page.scrl = &lv_style_transp_fit; theme.page.sb = &sb; #endif } @@ -459,20 +516,9 @@ static void page_init(void) static void ta_init(void) { #if USE_LV_TA - static lv_style_t oneline; - - lv_style_copy(&oneline, &def); - oneline.body.empty = 1; - oneline.body.radius = 0; - oneline.body.border.part = LV_BORDER_BOTTOM; - oneline.body.border.width = 3; - oneline.body.border.color = LV_COLOR_HEX3(0x333); - oneline.body.border.opa = LV_OPA_COVER; - oneline.text.color = LV_COLOR_HEX3(0x333); - - theme.ta.area = theme.panel; - theme.ta.oneline = &oneline; - theme.ta.cursor = NULL; /*Let library to calculate the cursor's style*/ + theme.ta.area = &panel; + theme.ta.oneline = &panel; + theme.ta.cursor = NULL; theme.ta.sb = &sb; #endif } @@ -480,78 +526,57 @@ static void ta_init(void) static void list_init(void) { #if USE_LV_LIST != 0 + static lv_style_t list_bg, list_rel, list_pr, list_trel, list_tpr, list_ina; + lv_style_copy(&list_rel, &def); + list_rel.body.empty = 1; + list_rel.body.border.width = 1; + list_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 50, 85); + list_rel.body.border.opa = LV_OPA_COVER; + list_rel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); + list_rel.text.font = _font; - static lv_style_t list_bg, rel, pr, tgl_rel, tgl_pr, ina; + lv_style_copy(&list_pr, &list_rel); + list_pr.body.empty = 0; + list_pr.body.opa = LV_OPA_COVER; + list_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 34, 41); + list_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 34, 41); + list_pr.text.color = lv_color_hsv_to_rgb(_hue, 7, 96); - lv_style_copy(&list_bg, theme.panel); + lv_style_copy(&list_trel, &list_rel); + lv_style_copy(&list_tpr, &list_pr); + lv_style_copy(&list_ina, &def); + + lv_style_copy(&list_bg, &list_rel); list_bg.body.padding.hor = 0; list_bg.body.padding.ver = 0; - list_bg.body.padding.inner = 0; - - lv_style_copy(&rel, &lv_style_transp); - rel.body.padding.hor = LV_DPI / 8; - rel.body.padding.ver = LV_DPI / 6; - rel.body.radius = 10; - rel.body.border.color = LV_COLOR_HEX3(0xbbb); - rel.body.border.width = 1; - rel.body.border.part = LV_BORDER_BOTTOM; - - lv_style_copy(&pr, &rel); - pr.glass = 0; - pr.body.main_color = LV_COLOR_HEX3(0xddd); - pr.body.grad_color = pr.body.main_color; - pr.body.border.width = 0; - pr.body.empty = 0; - pr.body.radius = DEF_RADIUS; - pr.text.font = _font; - - lv_style_copy(&tgl_rel, &pr); - tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); - tgl_rel.body.grad_color = tgl_rel.body.main_color; - tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); - - - lv_style_copy(&tgl_pr, &tgl_rel); - tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 60); - tgl_pr.body.grad_color = tgl_pr.body.main_color; - tgl_pr.body.border.width = 0; - - lv_style_copy(&ina, &pr); - ina.body.main_color = LV_COLOR_HEX3(0xccc); - ina.body.grad_color = ina.body.main_color; - theme.list.sb = &sb; theme.list.bg = &list_bg; theme.list.scrl = &lv_style_transp_tight; - theme.list.btn.rel = &rel; - theme.list.btn.pr = ≺ - theme.list.btn.tgl_rel = &tgl_rel; - theme.list.btn.tgl_pr = &tgl_pr; - theme.list.btn.ina = &ina; + theme.list.btn.rel = &list_rel; + theme.list.btn.pr = &list_pr; + theme.list.btn.tgl_rel = &list_trel; + theme.list.btn.tgl_pr = &list_tpr; + theme.list.btn.ina = &list_ina; #endif } static void ddlist_init(void) { #if USE_LV_DDLIST != 0 - static lv_style_t bg, sel; - lv_style_copy(&bg, theme.panel); - bg.body.padding.hor = LV_DPI / 6; - bg.body.padding.ver = LV_DPI / 6; - bg.text.line_space = LV_DPI / 8; + lv_style_copy(&ddlist_bg, &panel); + ddlist_bg.text.line_space = LV_DPI / 8; + ddlist_bg.body.padding.hor = LV_DPI / 6; + ddlist_bg.body.padding.ver = LV_DPI / 6; + lv_style_copy(&ddlist_sel, &panel); + ddlist_sel.body.main_color = lv_color_hsv_to_rgb(_hue, 45, 70); + ddlist_sel.body.grad_color = lv_color_hsv_to_rgb(_hue, 45, 70); + ddlist_sel.body.opa = LV_OPA_COVER; + ddlist_sel.body.radius = 0; - lv_style_copy(&sel, &bg); - sel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); - sel.body.grad_color = sel.body.main_color; - sel.body.border.width = 0; - sel.body.shadow.width = 0; - sel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); - - - theme.ddlist.bg = &bg; - theme.ddlist.sel = &sel; + theme.ddlist.bg = &ddlist_bg; + theme.ddlist.sel = &ddlist_sel; theme.ddlist.sb = &sb; #endif } @@ -560,17 +585,21 @@ static void roller_init(void) { #if USE_LV_ROLLER != 0 static lv_style_t roller_bg, roller_sel; + lv_style_copy(&roller_bg, &ddlist_bg); + roller_bg.text.line_space = LV_DPI / 6; + roller_bg.body.radius = LV_DPI / 20; + roller_bg.body.main_color = LV_COLOR_HEX3(0x500); + roller_bg.body.grad_color = LV_COLOR_HEX3(0x005); + roller_bg.body.border.opa = LV_OPA_30; + roller_bg.text.opa = LV_OPA_70; + roller_bg.text.color = lv_color_hsv_to_rgb(_hue, 20, 70); + roller_bg.body.shadow.width = 0; - lv_style_copy(&roller_bg, &lv_style_transp); - roller_bg.body.padding.hor = LV_DPI / 6; - roller_bg.body.padding.ver = LV_DPI / 6; - roller_bg.text.line_space = LV_DPI / 8; - roller_bg.text.font = _font; - roller_bg.glass = 0; - - lv_style_copy(&roller_sel, &roller_bg); - roller_sel.text.color = lv_color_hsv_to_rgb(_hue, 90, 70); - + lv_style_copy(&roller_sel, &panel); + roller_sel.body.empty = 1; + roller_sel.body.radius = 0; + roller_sel.text.opa = LV_OPA_COVER; + roller_sel.text.color = lv_color_hsv_to_rgb(_hue, 70, 95); theme.roller.bg = &roller_bg; theme.roller.sel = &roller_sel; @@ -580,106 +609,86 @@ static void roller_init(void) static void tabview_init(void) { #if USE_LV_TABVIEW != 0 - static lv_style_t indic, btn_bg, rel, pr, tgl_rel, tgl_pr; + static lv_style_t tab_rel, tab_pr, tab_trel, tab_tpr, tab_indic; + lv_style_copy(&tab_rel, &def); + tab_rel.body.main_color = LV_COLOR_HEX3(0x500); + tab_rel.body.grad_color = LV_COLOR_HEX3(0x005); + tab_rel.body.padding.hor = 0; + tab_rel.body.padding.ver = LV_DPI / 6; + tab_rel.body.padding.inner = 0; + tab_rel.body.border.width = 1; + tab_rel.body.border.color = LV_COLOR_SILVER; + tab_rel.body.border.opa = LV_OPA_40; + tab_rel.text.color = LV_COLOR_HEX3(0xDDD); + tab_rel.text.font = _font; - lv_style_copy(&indic, &def); - indic.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70); - indic.body.grad_color = indic.body.main_color; - indic.body.radius = 0; - indic.body.border.width = 0; - indic.body.padding.inner = LV_DPI / 20; + lv_style_copy(&tab_pr, &tab_rel); + tab_pr.body.main_color = LV_COLOR_HEX3(0x005); + tab_pr.body.grad_color = LV_COLOR_HEX3(0x500); - lv_style_copy(&btn_bg, &def); - btn_bg.body.main_color = LV_COLOR_HEX3(0xccc); - btn_bg.body.grad_color = btn_bg.body.main_color; - btn_bg.body.radius = 0; - btn_bg.body.border.width = 1; - btn_bg.body.border.color = LV_COLOR_HEX3(0x888); - btn_bg.body.border.part = LV_BORDER_BOTTOM; - btn_bg.body.border.opa = LV_OPA_COVER; - btn_bg.body.shadow.width = 5; - btn_bg.body.shadow.color = DEF_SHADOW_COLOR; - btn_bg.body.shadow.type = LV_SHADOW_BOTTOM; - btn_bg.body.padding.inner = 0; - btn_bg.body.padding.hor = 0; - btn_bg.body.padding.ver = 0; - btn_bg.text.color = LV_COLOR_HEX3(0x333); + lv_style_copy(&tab_trel, &def); + tab_trel.body.empty = 1; + tab_trel.body.padding.hor = 0; + tab_trel.body.padding.ver = LV_DPI / 6; + tab_trel.body.padding.inner = 0; + tab_trel.body.border.width = 1; + tab_trel.body.border.color = LV_COLOR_SILVER; + tab_trel.body.border.opa = LV_OPA_40; + tab_trel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); + tab_trel.text.font = _font; + lv_style_copy(&tab_tpr, &def); + tab_tpr.body.main_color = LV_COLOR_GRAY; + tab_tpr.body.grad_color = LV_COLOR_GRAY; + tab_tpr.body.padding.hor = 0; + tab_tpr.body.padding.ver = LV_DPI / 6; + tab_tpr.body.padding.inner = 0; + tab_tpr.body.border.width = 1; + tab_tpr.body.border.color = LV_COLOR_SILVER; + tab_tpr.body.border.opa = LV_OPA_40; + tab_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); + tab_tpr.text.font = _font; - lv_style_copy(&rel, &lv_style_transp); - rel.body.padding.ver = LV_DPI / 8; - rel.text.font = _font; + lv_style_copy(&tab_indic, &def); + tab_indic.body.border.width = 0; + tab_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 87); + tab_indic.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 87); + tab_indic.body.padding.inner = LV_DPI / 10; /*Indicator height*/ - lv_style_copy(&pr, &def); - pr.body.main_color = LV_COLOR_HEX3(0xbbb); - pr.body.grad_color = pr.body.main_color; - pr.body.border.width = 0; - pr.body.empty = 0; - pr.body.radius = 0; - pr.body.border.width = 1; - pr.body.border.color = LV_COLOR_HEX3(0x888); - pr.body.border.part = LV_BORDER_BOTTOM; - pr.body.border.opa = LV_OPA_COVER; - pr.text.color = LV_COLOR_HEX3(0x111); - - lv_style_copy(&tgl_rel, &lv_style_transp); - tgl_rel.glass = 0; - tgl_rel.text.font = _font; - tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 90, 70); - - lv_style_copy(&tgl_pr, &def); - tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 15, 85); - tgl_pr.body.grad_color = tgl_pr.body.main_color; - tgl_pr.body.border.width = 0; - tgl_pr.body.empty = 0; - tgl_pr.body.radius = 0; - tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 90, 60); - - theme.tabview.bg = theme.bg; - theme.tabview.indic = &indic; - theme.tabview.btn.bg = &btn_bg; - theme.tabview.btn.rel = &rel; - theme.tabview.btn.pr = ≺ - theme.tabview.btn.tgl_rel = &tgl_rel; - theme.tabview.btn.tgl_pr = &tgl_pr; + theme.tabview.bg = &bg; + theme.tabview.indic = &tab_indic; + theme.tabview.btn.bg = &lv_style_transp_tight; + theme.tabview.btn.rel = &tab_rel; + theme.tabview.btn.pr = &tab_pr; + theme.tabview.btn.tgl_rel = &tab_trel; + theme.tabview.btn.tgl_pr = &tab_tpr; #endif } - static void win_init(void) { #if USE_LV_WIN != 0 - static lv_style_t header, pr; + static lv_style_t win_header; - lv_style_copy(&header, &def); - header.body.main_color = LV_COLOR_HEX3(0xccc); - header.body.grad_color = header.body.main_color; - header.body.radius = DEF_RADIUS; - header.body.border.width = 1; - header.body.border.color = LV_COLOR_HEX3(0xbbb); - header.body.border.part = LV_BORDER_BOTTOM; - header.body.border.opa = LV_OPA_COVER; - header.body.padding.inner = 0; - header.body.padding.hor = 0; - header.body.padding.ver = 0; - header.text.color = LV_COLOR_HEX3(0x333); + lv_style_copy(&win_header, &def); + win_header.body.radius = 0; + win_header.body.padding.hor = LV_DPI / 12; + win_header.body.padding.ver = LV_DPI / 20; + win_header.body.main_color = lv_color_hsv_to_rgb(_hue, 20, 50); + win_header.body.grad_color = win_header.body.main_color; + win_header.body.border.opa = panel.body.border.opa; + win_header.body.border.width = panel.body.border.width; + win_header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80); + win_header.body.border.part = LV_BORDER_BOTTOM; + win_header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100); - lv_style_copy(&pr, &def); - pr.body.main_color = LV_COLOR_HEX3(0xbbb); - pr.body.grad_color = pr.body.main_color; - pr.body.border.width = 0; - pr.body.empty = 0; - pr.body.radius = 0; - pr.text.color = LV_COLOR_HEX3(0x111); - - - theme.win.bg = theme.panel; + theme.win.bg = &bg; theme.win.sb = &sb; - theme.win.header = &header; + theme.win.header = &win_header; theme.win.content.bg = &lv_style_transp; theme.win.content.scrl = &lv_style_transp; - theme.win.btn.rel = &lv_style_transp; - theme.win.btn.pr = ≺ + theme.win.btn.rel = &btn_rel; + theme.win.btn.pr = &btn_pr; #endif } @@ -687,8 +696,6 @@ static void win_init(void) * GLOBAL FUNCTIONS **********************/ - - /** * Initialize the nemo theme * @param hue [0..360] hue value from HSV color space to define the theme's base color @@ -711,13 +718,12 @@ lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t *font) } basic_init(); - cont_init(); btn_init(); label_init(); + bar_init(); img_init(); line_init(); led_init(); - bar_init(); slider_init(); sw_init(); lmeter_init();