2017-12-19 22:00:43 +01:00
|
|
|
/**
|
|
|
|
* @file lv_theme_zen.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_theme.h"
|
|
|
|
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_THEME_ZEN
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC VARIABLES
|
|
|
|
**********************/
|
|
|
|
static lv_theme_t theme;
|
|
|
|
/*Static style definitions*/
|
2019-01-01 01:20:10 +01:00
|
|
|
static lv_style_t def;
|
2017-12-19 22:00:43 +01:00
|
|
|
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)
|
|
|
|
{
|
2019-01-03 15:50:55 +01:00
|
|
|
static lv_style_t bg;
|
|
|
|
static lv_style_t panel;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
|
|
|
def.body.border.opa = LV_OPA_COVER;
|
|
|
|
def.text.font = _font;
|
|
|
|
def.text.color = LV_COLOR_HEX3(0x444);
|
2019-02-10 06:51:13 +01:00
|
|
|
def.image.color = LV_COLOR_HEX3(0x444);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&bg, &def);
|
|
|
|
bg.body.main_color = LV_COLOR_WHITE;
|
|
|
|
bg.body.grad_color = LV_COLOR_WHITE;
|
|
|
|
bg.body.radius = 0;
|
|
|
|
bg.body.border.width = 0;
|
|
|
|
bg.body.shadow.width = 0;
|
|
|
|
|
|
|
|
lv_style_copy(&panel, &bg);
|
|
|
|
panel.body.radius = LV_DPI / 10;
|
|
|
|
panel.body.border.width = 2;
|
|
|
|
panel.body.border.color = lv_color_hsv_to_rgb(_hue, 30, 90);
|
|
|
|
panel.body.border.opa = LV_OPA_COVER;
|
|
|
|
panel.body.shadow.width = 4;
|
|
|
|
panel.body.shadow.color = LV_COLOR_HEX3(0xddd);
|
2019-03-15 22:19:21 +01:00
|
|
|
panel.body.padding.left = LV_DPI / 6;
|
|
|
|
panel.body.padding.right = LV_DPI / 6;
|
|
|
|
panel.body.padding.top = LV_DPI / 8;
|
|
|
|
panel.body.padding.bottom = LV_DPI / 8;
|
2017-12-19 22:00:43 +01:00
|
|
|
panel.body.padding.inner = LV_DPI / 10;
|
|
|
|
|
2017-12-21 00:19:59 +01:00
|
|
|
lv_style_copy(&sb, &def);
|
|
|
|
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 90);
|
|
|
|
sb.body.grad_color = sb.body.main_color;
|
|
|
|
sb.body.border.width = 0;
|
|
|
|
sb.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
sb.body.padding.inner = LV_DPI / 10;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.bg = &bg;
|
|
|
|
theme.style.panel = &panel;
|
2017-12-19 22:00:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void cont_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CONT != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.cont = theme.style.panel;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void btn_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_BTN != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t rel, pr, tgl_pr, ina;
|
|
|
|
lv_style_copy(&rel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
rel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
rel.body.border.width = 2;
|
|
|
|
rel.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
|
|
|
rel.body.border.opa = LV_OPA_COVER;
|
|
|
|
rel.body.shadow.width = 4;
|
|
|
|
rel.body.shadow.color = LV_COLOR_HEX3(0xddd);
|
2019-03-15 22:19:21 +01:00
|
|
|
rel.body.padding.left = LV_DPI / 4;
|
|
|
|
rel.body.padding.right = LV_DPI / 4;
|
|
|
|
rel.body.padding.top = LV_DPI / 8;
|
|
|
|
rel.body.padding.bottom = LV_DPI / 8;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.text.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
2019-02-12 07:33:42 +01:00
|
|
|
rel.image.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&pr, &rel);
|
|
|
|
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
|
|
|
pr.body.shadow.width = 0;
|
2019-02-10 06:41:51 +01:00
|
|
|
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
2019-02-12 07:33:42 +01:00
|
|
|
pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&tgl_pr, &pr);
|
|
|
|
tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
|
|
|
tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
2019-02-12 07:33:42 +01:00
|
|
|
tgl_pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&ina, &tgl_pr);
|
|
|
|
ina.body.border.color = LV_COLOR_HEX3(0xbbb);
|
|
|
|
ina.text.color = LV_COLOR_HEX3(0xbbb);
|
2019-02-12 07:33:42 +01:00
|
|
|
ina.image.color = LV_COLOR_HEX3(0xbbb);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.btn.rel = &rel;
|
|
|
|
theme.style.btn.pr = ≺
|
|
|
|
theme.style.btn.tgl_rel = ≺
|
|
|
|
theme.style.btn.tgl_pr = &tgl_pr;
|
|
|
|
theme.style.btn.ina = &ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void label_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LABEL != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t prim, sec, hint;
|
|
|
|
lv_style_copy(&prim, &def);
|
|
|
|
lv_style_copy(&sec, &def);
|
|
|
|
lv_style_copy(&hint, &def);
|
|
|
|
|
|
|
|
prim.text.color = LV_COLOR_HEX3(0x555);
|
|
|
|
sec.text.color = lv_color_hsv_to_rgb(_hue, 50, 80);
|
|
|
|
hint.text.color = lv_color_hsv_to_rgb(_hue, 25, 85);
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.label.prim = &prim;
|
|
|
|
theme.style.label.sec = &sec;
|
|
|
|
theme.style.label.hint = &hint;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void img_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_IMG != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
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, 55);
|
|
|
|
img_light.image.intense = LV_OPA_80;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.img.light = &img_light;
|
|
|
|
theme.style.img.dark = &img_dark;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void line_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LINE != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.line.decor = &def;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void led_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LED != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
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;
|
2018-06-19 09:49:58 +02:00
|
|
|
led.body.border.width = LV_DPI / 30;
|
2017-12-19 22:00:43 +01:00
|
|
|
led.body.border.opa = LV_OPA_30;
|
2017-12-21 00:19:59 +01:00
|
|
|
led.body.main_color = lv_color_hsv_to_rgb(_hue, 60, 100);
|
|
|
|
led.body.grad_color = lv_color_hsv_to_rgb(_hue, 60, 40);
|
2017-12-19 22:00:43 +01:00
|
|
|
led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60);
|
2017-12-21 00:19:59 +01:00
|
|
|
led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 80, 100);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.led = &led;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bar_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_BAR
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t bg, indic;
|
|
|
|
|
|
|
|
lv_style_copy(&bg, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
bg.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
bg.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
bg.body.border.width = 2;
|
|
|
|
bg.body.border.opa = LV_OPA_COVER;
|
|
|
|
bg.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
|
|
|
|
|
|
|
lv_style_copy(&indic, &def);
|
|
|
|
indic.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
indic.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
|
|
|
indic.body.grad_color = indic.body.main_color;
|
|
|
|
indic.body.border.width = 0;
|
2019-03-15 22:19:21 +01:00
|
|
|
indic.body.padding.left = LV_DPI / 20;
|
|
|
|
indic.body.padding.right = LV_DPI / 20;
|
|
|
|
indic.body.padding.top = LV_DPI / 20;
|
|
|
|
indic.body.padding.bottom = LV_DPI / 20;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.bar.bg = &bg;
|
|
|
|
theme.style.bar.indic = &indic;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void slider_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_SLIDER != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t knob;
|
|
|
|
|
|
|
|
lv_style_copy(&knob, &def);
|
2019-02-11 09:35:06 +01:00
|
|
|
knob.body.main_color = theme.style.bar.indic->body.main_color;
|
2017-12-19 22:00:43 +01:00
|
|
|
knob.body.grad_color = knob.body.main_color;
|
|
|
|
knob.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
knob.body.border.width = 0;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.slider.bg = theme.style.bar.bg;
|
|
|
|
theme.style.slider.indic = theme.style.bar.indic;
|
|
|
|
theme.style.slider.knob = &knob;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sw_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_SW != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t indic;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&indic, theme.style.slider.indic);
|
2017-12-19 22:00:43 +01:00
|
|
|
indic.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
indic.body.main_color = lv_color_hsv_to_rgb(_hue, 15, 95);
|
|
|
|
indic.body.grad_color = indic.body.main_color;
|
2019-02-11 09:35:06 +01:00
|
|
|
indic.body.border.width = theme.style.slider.bg->body.border.width;
|
|
|
|
indic.body.border.color = theme.style.slider.bg->body.border.color;
|
|
|
|
indic.body.border.opa = theme.style.slider.bg->body.border.opa;
|
2019-03-15 22:19:21 +01:00
|
|
|
indic.body.padding.left = 0;
|
|
|
|
indic.body.padding.right = 0;
|
|
|
|
indic.body.padding.top = 0;
|
|
|
|
indic.body.padding.bottom = 0;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.sw.bg = theme.style.slider.bg;
|
|
|
|
theme.style.sw.indic = &indic;
|
|
|
|
theme.style.sw.knob_off = theme.style.slider.knob;
|
|
|
|
theme.style.sw.knob_on = theme.style.slider.knob;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void lmeter_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LMETER != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t lmeter;
|
|
|
|
|
|
|
|
lv_style_copy(&lmeter, &def);
|
|
|
|
lmeter.line.color = LV_COLOR_HEX3(0xddd);
|
2018-01-02 12:59:18 +01:00
|
|
|
lmeter.line.width = 2;
|
2017-12-19 22:00:43 +01:00
|
|
|
lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
|
|
|
lmeter.body.grad_color = lmeter.body.main_color;
|
2019-03-15 22:19:21 +01:00
|
|
|
lmeter.body.padding.left = LV_DPI / 8;
|
|
|
|
lmeter.body.padding.right = LV_DPI / 8;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.lmeter = &lmeter;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gauge_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_GAUGE != 0
|
2017-12-21 00:19:59 +01:00
|
|
|
static lv_style_t gauge;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2017-12-21 00:19:59 +01:00
|
|
|
lv_style_copy(&gauge, &def);
|
|
|
|
gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70);
|
2018-05-08 11:28:07 +02:00
|
|
|
gauge.line.width = 1;
|
2017-12-21 00:19:59 +01:00
|
|
|
gauge.body.main_color = LV_COLOR_HEX3(0x999);
|
|
|
|
gauge.body.grad_color = gauge.body.main_color;
|
2019-03-15 22:19:21 +01:00
|
|
|
gauge.body.padding.left = LV_DPI / 16;
|
|
|
|
gauge.body.padding.right = LV_DPI / 16;
|
2017-12-21 00:19:59 +01:00
|
|
|
gauge.body.border.color = LV_COLOR_HEX3(0x666); /*Needle middle color*/
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.gauge = &gauge;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-09-20 22:14:33 +02:00
|
|
|
static void arc_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_ARC != 0
|
2018-09-20 22:14:33 +02:00
|
|
|
|
|
|
|
static lv_style_t arc;
|
|
|
|
lv_style_copy(&arc, &def);
|
|
|
|
arc.line.width = 10;
|
|
|
|
arc.line.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
2018-09-20 22:47:32 +02:00
|
|
|
arc.line.rounded = 1;
|
|
|
|
|
|
|
|
/*For preloader*/
|
2018-09-20 22:14:33 +02:00
|
|
|
arc.body.border.width = 0;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.arc = &arc;
|
2018-09-20 22:14:33 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void preload_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_PRELOAD != 0
|
2018-09-20 22:14:33 +02:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.preload = theme.style.arc;
|
2018-09-20 22:14:33 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-12-19 22:00:43 +01:00
|
|
|
static void chart_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CHART
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.chart = theme.style.panel;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-09-12 23:34:23 +02:00
|
|
|
static void calendar_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CALENDAR != 0
|
2018-09-12 23:34:23 +02:00
|
|
|
static lv_style_t ina_days;
|
|
|
|
lv_style_copy(&ina_days, &def);
|
|
|
|
ina_days.text.color = lv_color_hsv_to_rgb(_hue, 0, 70);
|
|
|
|
|
|
|
|
static lv_style_t high_days;
|
|
|
|
lv_style_copy(&high_days, &def);
|
|
|
|
high_days.text.color = lv_color_hsv_to_rgb(_hue, 50, 90);
|
|
|
|
|
|
|
|
static lv_style_t today_box;
|
|
|
|
lv_style_copy(&today_box, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
today_box.body.opa = LV_OPA_TRANSP;
|
2019-02-11 09:35:06 +01:00
|
|
|
today_box.body.border.color = theme.style.panel->body.border.color;
|
2019-03-15 22:19:21 +01:00
|
|
|
today_box.body.padding.top = LV_DPI / 20;
|
|
|
|
today_box.body.padding.bottom = LV_DPI / 20;
|
2018-09-27 15:06:44 +02:00
|
|
|
today_box.body.radius = LV_RADIUS_CIRCLE;
|
2018-09-12 23:34:23 +02:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.calendar.bg = theme.style.panel;
|
|
|
|
theme.style.calendar.header = &lv_style_transp;
|
|
|
|
theme.style.calendar.inactive_days = &ina_days;
|
|
|
|
theme.style.calendar.highlighted_days = &high_days;
|
|
|
|
theme.style.calendar.week_box = &lv_style_transp_fit;
|
|
|
|
theme.style.calendar.today_box = &today_box;
|
2018-09-12 23:34:23 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-12-19 22:00:43 +01:00
|
|
|
static void cb_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CB != 0
|
2018-10-05 17:22:49 +02:00
|
|
|
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
lv_style_copy(&rel, &def);
|
|
|
|
rel.body.radius = LV_DPI / 20;
|
|
|
|
rel.body.shadow.width = 0;
|
|
|
|
rel.body.border.width = 3;
|
|
|
|
rel.body.border.opa = LV_OPA_COVER;
|
|
|
|
rel.body.border.color = lv_color_hsv_to_rgb(_hue, 35, 80);
|
|
|
|
rel.body.main_color = LV_COLOR_HEX3(0xfff);
|
|
|
|
rel.body.grad_color = rel.body.main_color;
|
|
|
|
|
|
|
|
|
|
|
|
lv_style_copy(&pr, &rel);
|
|
|
|
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 35, 70);
|
|
|
|
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_rel, &rel);
|
|
|
|
tgl_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 45, 80);
|
|
|
|
tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
|
|
|
tgl_rel.body.grad_color = tgl_rel.body.main_color;
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_pr, &rel);
|
|
|
|
tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 45, 70);
|
|
|
|
tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 80);
|
|
|
|
tgl_pr.body.grad_color = tgl_pr.body.main_color;
|
|
|
|
|
|
|
|
|
|
|
|
lv_style_copy(&ina, &rel);
|
|
|
|
ina.body.border.color = LV_COLOR_HEX3(0xaaa);
|
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.cb.bg = &lv_style_transp;
|
|
|
|
theme.style.cb.box.rel = &rel;
|
|
|
|
theme.style.cb.box.pr = ≺
|
|
|
|
theme.style.cb.box.tgl_rel = &tgl_rel;
|
|
|
|
theme.style.cb.box.tgl_pr = &tgl_pr;
|
|
|
|
theme.style.cb.box.ina = &ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void btnm_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_BTNM
|
2018-10-05 17:22:49 +02:00
|
|
|
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&bg, &lv_style_transp);
|
|
|
|
bg.glass = 0;
|
2019-03-15 22:19:21 +01:00
|
|
|
bg.body.padding.left = 0;
|
|
|
|
bg.body.padding.right = 0;
|
|
|
|
bg.body.padding.top = 0;
|
|
|
|
bg.body.padding.bottom = 0;
|
2017-12-19 22:00:43 +01:00
|
|
|
bg.body.padding.inner = LV_DPI / 15;
|
|
|
|
bg.text.font = _font;
|
|
|
|
|
|
|
|
lv_style_copy(&rel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
rel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.body.border.width = 0;
|
|
|
|
|
|
|
|
lv_style_copy(&pr, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
pr.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
pr.body.radius = LV_DPI / 1;
|
|
|
|
pr.body.border.width = 2;
|
|
|
|
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
|
|
|
pr.body.border.opa = LV_OPA_COVER;
|
|
|
|
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_rel, &pr);
|
2019-02-28 13:33:55 +01:00
|
|
|
tgl_rel.body.opa = LV_OPA_COVER;
|
2017-12-19 22:00:43 +01:00
|
|
|
tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 15, 95);
|
|
|
|
tgl_rel.body.grad_color = tgl_rel.body.main_color;
|
|
|
|
tgl_rel.body.border.width = 0;
|
|
|
|
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 60, 40);
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_pr, &tgl_rel);
|
|
|
|
tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 70);
|
|
|
|
tgl_pr.body.grad_color = tgl_pr.body.main_color;
|
|
|
|
|
|
|
|
lv_style_copy(&ina, &pr);
|
|
|
|
ina.body.main_color = LV_COLOR_HEX3(0x888);
|
|
|
|
ina.body.grad_color = tgl_pr.body.main_color;
|
|
|
|
ina.text.color = LV_COLOR_HEX3(0x888);;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.btnm.bg = &bg;
|
|
|
|
theme.style.btnm.btn.rel = &rel;
|
|
|
|
theme.style.btnm.btn.pr = ≺
|
|
|
|
theme.style.btnm.btn.tgl_rel = &tgl_rel;
|
|
|
|
theme.style.btnm.btn.tgl_pr = &tgl_pr;
|
|
|
|
theme.style.btnm.btn.ina = &ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void kb_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_KB
|
2018-10-05 17:22:49 +02:00
|
|
|
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
lv_style_copy(&bg, &def);
|
2018-06-19 09:49:58 +02:00
|
|
|
bg.body.main_color = LV_COLOR_HEX3(0x666);
|
|
|
|
bg.body.grad_color = bg.body.main_color;
|
2019-03-15 22:19:21 +01:00
|
|
|
bg.body.padding.left = 0;
|
|
|
|
bg.body.padding.right = 0;
|
|
|
|
bg.body.padding.top = 0;
|
|
|
|
bg.body.padding.bottom = 0;
|
2018-06-19 09:49:58 +02:00
|
|
|
bg.body.padding.inner = 0;
|
|
|
|
bg.body.radius = 0;
|
|
|
|
bg.body.border.width = 0;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&rel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
rel.body.opa = LV_OPA_COVER;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.body.radius = 0;
|
|
|
|
rel.body.border.width = 1;
|
|
|
|
rel.body.border.color = LV_COLOR_HEX3(0x888);
|
|
|
|
rel.body.border.opa = LV_OPA_COVER;
|
|
|
|
rel.text.color = LV_COLOR_WHITE;
|
|
|
|
|
|
|
|
lv_style_copy(&pr, &def);
|
|
|
|
pr.body.main_color = LV_COLOR_HEX3(0xeee);
|
|
|
|
pr.body.grad_color = pr.body.main_color;
|
|
|
|
pr.body.border.color = LV_COLOR_HEX3(0x888);
|
|
|
|
pr.body.border.width = 1;
|
|
|
|
pr.body.border.opa = LV_OPA_COVER;
|
|
|
|
pr.body.radius = 0;
|
|
|
|
pr.text.color = LV_COLOR_HEX3(0x666);
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_rel, &pr);
|
|
|
|
tgl_rel.body.main_color = LV_COLOR_HEX3(0x999);
|
|
|
|
tgl_rel.body.grad_color = tgl_rel.body.main_color;
|
|
|
|
tgl_rel.text.color = LV_COLOR_WHITE;
|
|
|
|
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_pr, &pr);
|
|
|
|
tgl_pr.body.main_color = LV_COLOR_HEX3(0xbbb);
|
|
|
|
tgl_pr.body.grad_color = tgl_pr.body.main_color;
|
|
|
|
tgl_pr.text.color = LV_COLOR_HEX3(0xddd);
|
|
|
|
|
|
|
|
lv_style_copy(&ina, &pr);
|
|
|
|
ina.body.main_color = LV_COLOR_HEX3(0x777);
|
|
|
|
ina.body.grad_color = ina.body.main_color;
|
|
|
|
ina.text.color = LV_COLOR_HEX3(0xbbb);
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.kb.bg = &bg;
|
|
|
|
theme.style.kb.btn.rel = &rel;
|
|
|
|
theme.style.kb.btn.pr = ≺
|
|
|
|
theme.style.kb.btn.tgl_rel = &tgl_rel;
|
|
|
|
theme.style.kb.btn.tgl_pr = &tgl_pr;
|
|
|
|
theme.style.kb.btn.ina = &ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mbox_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_MBOX
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t bg, rel, pr;
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&bg, theme.style.panel);
|
2017-12-19 22:00:43 +01:00
|
|
|
bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 95);
|
|
|
|
bg.body.grad_color = bg.body.main_color;
|
|
|
|
bg.text.color = lv_color_hsv_to_rgb(_hue, 40, 25);
|
|
|
|
|
|
|
|
lv_style_copy(&rel, &def);
|
|
|
|
rel.body.main_color = lv_color_hsv_to_rgb(_hue, 25, 85);
|
|
|
|
rel.body.grad_color = rel.body.main_color;
|
|
|
|
rel.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
rel.body.border.width = 2;
|
|
|
|
rel.body.border.color = lv_color_hsv_to_rgb(_hue, 30, 70);
|
2019-03-15 22:19:21 +01:00
|
|
|
rel.body.padding.left = LV_DPI / 4;
|
|
|
|
rel.body.padding.right = LV_DPI / 4;
|
|
|
|
rel.body.padding.top = LV_DPI / 8;
|
|
|
|
rel.body.padding.bottom = LV_DPI / 8;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.text.color = bg.text.color;
|
|
|
|
|
|
|
|
lv_style_copy(&pr, &rel);
|
|
|
|
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 30, 90);
|
|
|
|
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 40);
|
|
|
|
pr.body.main_color = lv_color_hsv_to_rgb(_hue, 20, 85);
|
|
|
|
pr.body.grad_color = pr.body.main_color;
|
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.mbox.bg = &bg;
|
|
|
|
theme.style.mbox.btn.bg = &lv_style_transp;
|
|
|
|
theme.style.mbox.btn.rel = &rel;
|
|
|
|
theme.style.mbox.btn.pr = ≺
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void page_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_PAGE
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.page.bg = theme.style.panel;
|
|
|
|
theme.style.page.scrl = &lv_style_transp;
|
|
|
|
theme.style.page.sb = &sb;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ta_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TA
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t oneline;
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&oneline, theme.style.panel);
|
2017-12-19 22:00:43 +01:00
|
|
|
oneline.body.radius = LV_RADIUS_CIRCLE;
|
2019-03-15 22:19:21 +01:00
|
|
|
oneline.body.padding.top = LV_DPI / 10;
|
|
|
|
oneline.body.padding.bottom = LV_DPI / 10;
|
2017-12-19 22:00:43 +01:00
|
|
|
oneline.body.shadow.width = 0;
|
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.ta.area = theme.style.panel;
|
|
|
|
theme.style.ta.oneline = &oneline;
|
|
|
|
theme.style.ta.cursor = NULL; /*Let library to calculate the cursor's style*/
|
|
|
|
theme.style.ta.sb = &def;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-01-01 01:20:10 +01:00
|
|
|
static void spinbox_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_SPINBOX
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.spinbox.bg= theme.style.panel;
|
|
|
|
theme.style.spinbox.cursor = theme.style.ta.cursor;
|
|
|
|
theme.style.spinbox.sb = theme.style.ta.sb;
|
2019-01-01 01:20:10 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-12-19 22:00:43 +01:00
|
|
|
static void list_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LIST != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&bg, theme.style.panel);
|
2019-03-15 22:19:21 +01:00
|
|
|
bg.body.padding.left = 0;
|
|
|
|
bg.body.padding.right = 0;
|
|
|
|
bg.body.padding.top = 0;
|
|
|
|
bg.body.padding.bottom = 0;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&rel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
rel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.body.border.width = 0;
|
2019-03-15 22:19:21 +01:00
|
|
|
rel.body.padding.left = LV_DPI / 8;
|
|
|
|
rel.body.padding.right = LV_DPI / 8;
|
|
|
|
rel.body.padding.top = LV_DPI / 8;
|
|
|
|
rel.body.padding.bottom = LV_DPI / 8;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.text.color = LV_COLOR_HEX3(0x666);
|
2019-02-10 06:41:51 +01:00
|
|
|
rel.image.color = LV_COLOR_HEX3(0x666);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&pr, &rel);
|
2019-02-11 09:35:06 +01:00
|
|
|
pr.text.color = theme.style.btn.pr->text.color;
|
2019-02-15 08:04:54 +01:00
|
|
|
pr.image.color = theme.style.btn.pr->image.color;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&tgl_rel, &rel);
|
|
|
|
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 90);
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_pr, &rel);
|
2019-02-11 09:35:06 +01:00
|
|
|
tgl_pr.text.color = theme.style.btn.tgl_pr->text.color;
|
2019-02-15 08:04:54 +01:00
|
|
|
tgl_pr.image.color = theme.style.btn.tgl_pr->image.color;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&ina, &rel);
|
2019-02-11 09:35:06 +01:00
|
|
|
ina.text.color = theme.style.btn.ina->text.color;
|
2019-02-15 08:04:54 +01:00
|
|
|
ina.image.color = theme.style.btn.ina->image.color;
|
2019-02-11 09:35:06 +01:00
|
|
|
|
|
|
|
theme.style.list.sb = &sb;
|
|
|
|
theme.style.list.bg = &bg;
|
|
|
|
theme.style.list.scrl = &lv_style_transp_tight;
|
|
|
|
theme.style.list.btn.rel = &rel;
|
|
|
|
theme.style.list.btn.pr = ≺
|
|
|
|
theme.style.list.btn.tgl_rel = &tgl_rel;
|
|
|
|
theme.style.list.btn.tgl_pr = &tgl_pr;
|
|
|
|
theme.style.list.btn.ina = &ina;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ddlist_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_DDLIST != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t bg, sel;
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&bg, theme.style.panel);
|
2017-12-19 22:00:43 +01:00
|
|
|
bg.text.line_space = LV_DPI / 8;
|
2019-03-15 22:19:21 +01:00
|
|
|
bg.body.padding.left = LV_DPI / 6;
|
|
|
|
bg.body.padding.right = LV_DPI / 6;
|
|
|
|
bg.body.padding.top = LV_DPI / 8;
|
|
|
|
bg.body.padding.bottom = LV_DPI / 8;
|
2017-12-19 22:00:43 +01:00
|
|
|
bg.text.color = LV_COLOR_HEX3(0x666);
|
|
|
|
|
|
|
|
lv_style_copy(&sel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
sel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
sel.body.border.width = 0;
|
|
|
|
sel.text.color = lv_color_hsv_to_rgb(_hue, 50, 80);
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.ddlist.bg = &bg;
|
|
|
|
theme.style.ddlist.sel = &sel;
|
|
|
|
theme.style.ddlist.sb = &def;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void roller_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_ROLLER != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t bg, sel;
|
|
|
|
lv_style_copy(&bg, &def);
|
|
|
|
bg.body.border.width = 0;
|
2019-02-28 13:33:55 +01:00
|
|
|
bg.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
bg.text.line_space = LV_DPI / 6;
|
|
|
|
bg.text.color = LV_COLOR_HEX3(0x999);
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&sel, theme.style.panel);
|
2017-12-19 22:00:43 +01:00
|
|
|
sel.body.radius = LV_RADIUS_CIRCLE;
|
2019-02-28 13:33:55 +01:00
|
|
|
sel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.roller.bg = &bg;
|
|
|
|
theme.style.roller.sel = &sel;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tabview_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TABVIEW != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t btn_bg, indic, rel, pr, tgl_rel, tgl_pr;
|
|
|
|
|
|
|
|
lv_style_copy(&btn_bg, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
btn_bg.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
btn_bg.body.border.width = 2;
|
|
|
|
btn_bg.body.border.part = LV_BORDER_BOTTOM;
|
|
|
|
btn_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
|
|
|
|
|
|
|
lv_style_copy(&indic, &def);
|
|
|
|
indic.body.padding.inner = LV_DPI / 16;
|
|
|
|
indic.body.border.width = 0;
|
|
|
|
indic.body.radius = LV_RADIUS_CIRCLE;
|
|
|
|
indic.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 80);
|
|
|
|
indic.body.grad_color = indic.body.main_color;
|
|
|
|
|
|
|
|
lv_style_copy(&rel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
rel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.body.border.width = 0;
|
|
|
|
rel.text.color = LV_COLOR_HEX3(0x999);
|
|
|
|
|
|
|
|
|
|
|
|
lv_style_copy(&pr, &rel);
|
|
|
|
pr.text.color = LV_COLOR_HEX3(0x777);
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_rel, &rel);
|
|
|
|
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 80);
|
|
|
|
|
|
|
|
lv_style_copy(&tgl_pr, &rel);
|
|
|
|
tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 50, 70);
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.tabview.bg = theme.style.bg;
|
|
|
|
theme.style.tabview.indic = &indic;
|
|
|
|
theme.style.tabview.btn.bg = &btn_bg;
|
|
|
|
theme.style.tabview.btn.rel = &rel;
|
|
|
|
theme.style.tabview.btn.pr = ≺
|
|
|
|
theme.style.tabview.btn.tgl_rel = &tgl_rel;
|
|
|
|
theme.style.tabview.btn.tgl_pr = &tgl_pr;
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-01-01 01:20:10 +01:00
|
|
|
static void tileview_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TILEVIEW != 0
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.tileview.bg = &lv_style_transp_tight;
|
|
|
|
theme.style.tileview.scrl = &lv_style_transp_tight;
|
|
|
|
theme.style.tileview.sb = theme.style.page.sb;
|
2019-01-01 01:20:10 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void table_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TABLE != 0
|
2019-01-01 01:20:10 +01:00
|
|
|
static lv_style_t cell;
|
2019-02-11 09:35:06 +01:00
|
|
|
lv_style_copy(&cell, theme.style.panel);
|
2019-01-01 01:20:10 +01:00
|
|
|
cell.body.radius = 0;
|
|
|
|
cell.body.border.width = 1;
|
|
|
|
cell.body.shadow.width = 0;
|
2019-03-15 22:19:21 +01:00
|
|
|
cell.body.padding.left = LV_DPI / 12;
|
|
|
|
cell.body.padding.right = LV_DPI / 12;
|
|
|
|
cell.body.padding.top = LV_DPI / 12;
|
|
|
|
cell.body.padding.bottom = LV_DPI / 12;
|
2019-01-01 01:20:10 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.table.bg = &lv_style_transp_tight;
|
|
|
|
theme.style.table.cell = &cell;
|
2019-01-01 01:20:10 +01:00
|
|
|
#endif
|
|
|
|
}
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
static void win_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_WIN != 0
|
2017-12-19 22:00:43 +01:00
|
|
|
static lv_style_t header, rel, pr;
|
|
|
|
|
|
|
|
lv_style_copy(&header, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
header.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
header.body.border.width = 2;
|
|
|
|
header.body.border.part = LV_BORDER_BOTTOM;
|
|
|
|
header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
|
|
|
header.text.color = LV_COLOR_HEX3(0x666);
|
2019-02-10 06:51:13 +01:00
|
|
|
header.image.color = LV_COLOR_HEX3(0x666);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&rel, &def);
|
2019-02-28 13:33:55 +01:00
|
|
|
rel.body.opa = LV_OPA_TRANSP;
|
2017-12-19 22:00:43 +01:00
|
|
|
rel.body.border.width = 0;
|
|
|
|
rel.text.color = LV_COLOR_HEX3(0x666);
|
2019-02-10 06:41:51 +01:00
|
|
|
rel.image.color = LV_COLOR_HEX3(0x666);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
|
|
|
lv_style_copy(&pr, &rel);
|
|
|
|
pr.text.color = LV_COLOR_HEX3(0x333);
|
2019-02-10 06:41:51 +01:00
|
|
|
pr.image.color = LV_COLOR_HEX3(0x333);
|
2017-12-19 22:00:43 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.win.bg = theme.style.panel;
|
|
|
|
theme.style.win.sb = &sb;
|
|
|
|
theme.style.win.header = &header;
|
|
|
|
theme.style.win.content.bg = &lv_style_transp;
|
|
|
|
theme.style.win.content.scrl = &lv_style_transp;
|
|
|
|
theme.style.win.btn.rel = &rel;
|
|
|
|
theme.style.win.btn.pr = ≺
|
2017-12-19 22:00:43 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_GROUP
|
2019-02-18 08:34:41 +01:00
|
|
|
|
2019-03-08 07:54:36 +01:00
|
|
|
static void style_mod(lv_group_t * group, lv_style_t * style)
|
2019-02-15 08:59:53 +01:00
|
|
|
{
|
2019-03-08 07:54:36 +01:00
|
|
|
(void) group; /*Unused*/
|
2019-02-15 08:59:53 +01:00
|
|
|
#if LV_COLOR_DEPTH != 1
|
|
|
|
/*Make the style to be a little bit orange*/
|
|
|
|
style->body.border.opa = LV_OPA_COVER;
|
2019-02-15 09:54:47 +01:00
|
|
|
style->body.border.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
2019-02-15 08:59:53 +01:00
|
|
|
|
|
|
|
/*If not empty or has border then emphasis the border*/
|
2019-02-28 13:33:55 +01:00
|
|
|
if (style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
2019-02-15 08:59:53 +01:00
|
|
|
#else
|
|
|
|
style->body.border.opa = LV_OPA_COVER;
|
|
|
|
style->body.border.color = LV_COLOR_BLACK;
|
|
|
|
style->body.border.width = 2;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-03-08 07:54:36 +01:00
|
|
|
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
2019-02-15 08:59:53 +01:00
|
|
|
{
|
2019-03-08 07:54:36 +01:00
|
|
|
(void) group; /*Unused*/
|
|
|
|
|
2019-02-15 08:59:53 +01:00
|
|
|
#if LV_COLOR_DEPTH != 1
|
|
|
|
/*Make the style to be a little bit orange*/
|
|
|
|
style->body.border.opa = LV_OPA_COVER;
|
|
|
|
style->body.border.color = LV_COLOR_GREEN;
|
|
|
|
|
|
|
|
/*If not empty or has border then emphasis the border*/
|
2019-02-28 13:33:55 +01:00
|
|
|
if (style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
2019-02-15 08:59:53 +01:00
|
|
|
|
|
|
|
style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_GREEN, LV_OPA_70);
|
|
|
|
style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_GREEN, LV_OPA_70);
|
|
|
|
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60);
|
|
|
|
|
|
|
|
style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70);
|
|
|
|
#else
|
|
|
|
style->body.border.opa = LV_OPA_COVER;
|
|
|
|
style->body.border.color = LV_COLOR_BLACK;
|
|
|
|
style->body.border.width = 3;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#endif /*LV_USE_GROUP*/
|
2019-02-18 08:34:41 +01:00
|
|
|
|
2017-12-19 22:00:43 +01:00
|
|
|
/**********************
|
|
|
|
* GLOBAL FUNCTIONS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the zen 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
|
|
|
|
*/
|
2018-06-19 09:49:58 +02:00
|
|
|
lv_theme_t * lv_theme_zen_init(uint16_t hue, lv_font_t * font)
|
2017-12-19 22:00:43 +01:00
|
|
|
{
|
|
|
|
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;
|
2019-02-12 15:02:43 +01:00
|
|
|
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
|
|
|
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
2017-12-19 22:00:43 +01:00
|
|
|
*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();
|
2018-09-20 22:14:33 +02:00
|
|
|
arc_init();
|
|
|
|
preload_init();
|
2017-12-19 22:00:43 +01:00
|
|
|
chart_init();
|
2018-09-12 23:34:23 +02:00
|
|
|
calendar_init();
|
2017-12-19 22:00:43 +01:00
|
|
|
cb_init();
|
|
|
|
btnm_init();
|
|
|
|
kb_init();
|
|
|
|
mbox_init();
|
|
|
|
page_init();
|
|
|
|
ta_init();
|
2019-01-01 01:20:10 +01:00
|
|
|
spinbox_init();
|
2017-12-19 22:00:43 +01:00
|
|
|
list_init();
|
|
|
|
ddlist_init();
|
|
|
|
roller_init();
|
|
|
|
tabview_init();
|
2019-01-01 01:20:10 +01:00
|
|
|
tileview_init();
|
|
|
|
table_init();
|
2017-12-19 22:00:43 +01:00
|
|
|
win_init();
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_GROUP
|
2019-02-15 08:59:53 +01:00
|
|
|
theme.group.style_mod = style_mod;
|
|
|
|
theme.group.style_mod_edit = style_mod_edit;
|
2019-02-18 08:34:41 +01:00
|
|
|
#endif
|
2019-02-15 08:59:53 +01:00
|
|
|
|
2017-12-19 22:00:43 +01:00
|
|
|
return &theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a pointer to the theme
|
|
|
|
* @return pointer to the theme
|
|
|
|
*/
|
|
|
|
lv_theme_t * lv_theme_get_zen(void)
|
|
|
|
{
|
|
|
|
return &theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC FUNCTIONS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|