2017-11-18 00:17:21 +01:00
|
|
|
/**
|
|
|
|
* @file lv_theme_default.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_theme.h"
|
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_THEME_DEFAULT
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC VARIABLES
|
|
|
|
**********************/
|
|
|
|
static lv_theme_t theme;
|
|
|
|
static lv_style_t def;
|
|
|
|
|
|
|
|
/*Static style definitions*/
|
|
|
|
static lv_style_t sb;
|
|
|
|
static lv_style_t plain_bordered;
|
|
|
|
static lv_style_t label_prim;
|
|
|
|
static lv_style_t label_sec;
|
|
|
|
static lv_style_t label_hint;
|
|
|
|
static lv_style_t slider_bg;
|
|
|
|
static lv_style_t sw_bg;
|
|
|
|
static lv_style_t lmeter;
|
|
|
|
|
|
|
|
/*Saved input parameters*/
|
|
|
|
static uint16_t _hue;
|
2017-11-23 21:28:36 +01:00
|
|
|
static lv_font_t * _font;
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC FUNCTIONS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
static void basic_init(void)
|
|
|
|
{
|
|
|
|
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
|
|
|
|
|
|
|
lv_style_copy(&sb, &lv_style_pretty_color);
|
2017-11-20 14:26:18 +01:00
|
|
|
sb.body.grad_color = sb.body.main_color;
|
2019-03-15 22:19:21 +01:00
|
|
|
sb.body.padding.right = sb.body.padding.right/ 2; /*Make closer to the edges*/
|
|
|
|
sb.body.padding.bottom = sb.body.padding.bottom / 2;
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
lv_style_copy(&plain_bordered, &lv_style_plain);
|
2017-12-07 19:22:23 +01:00
|
|
|
plain_bordered.body.border.width = 2;
|
2018-06-19 09:49:58 +02:00
|
|
|
plain_bordered.body.border.color = LV_COLOR_HEX3(0xbbb);
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.bg = &lv_style_plain;
|
|
|
|
theme.style.panel = &lv_style_pretty;
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void btn_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_BTN != 0
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.btn.pr = &lv_style_btn_pr;
|
|
|
|
theme.style.btn.tgl_rel = &lv_style_btn_tgl_rel;
|
|
|
|
theme.style.btn.tgl_pr = &lv_style_btn_tgl_pr;
|
|
|
|
theme.style.btn.ina = &lv_style_btn_ina;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void label_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LABEL != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
lv_style_copy(&label_prim, &lv_style_plain);
|
|
|
|
lv_style_copy(&label_sec, &lv_style_plain);
|
|
|
|
lv_style_copy(&label_hint, &lv_style_plain);
|
|
|
|
|
2017-11-23 21:28:36 +01:00
|
|
|
label_prim.text.color = LV_COLOR_HEX3(0x111);
|
|
|
|
label_sec.text.color = LV_COLOR_HEX3(0x888);
|
|
|
|
label_hint.text.color = LV_COLOR_HEX3(0xaaa);
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.label.prim = &label_prim;
|
|
|
|
theme.style.label.sec = &label_sec;
|
|
|
|
theme.style.label.hint = &label_hint;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void img_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_IMG != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.img.light = &def;
|
|
|
|
theme.style.img.dark = &def;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void line_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LINE != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.line.decor = &def;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void led_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LED != 0
|
2017-11-18 00:17:21 +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-11-23 21:28:36 +01:00
|
|
|
led.body.border.opa = LV_OPA_30;
|
2017-11-18 00:17:21 +01:00
|
|
|
led.body.shadow.color = led.body.main_color;
|
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.led = &led;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bar_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_BAR
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.bar.bg = &lv_style_pretty;
|
|
|
|
theme.style.bar.indic = &lv_style_pretty_color;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void slider_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_SLIDER != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
lv_style_copy(&slider_bg, &lv_style_pretty);
|
2019-03-15 22:19:21 +01:00
|
|
|
slider_bg.body.padding.left = LV_DPI / 20;
|
|
|
|
slider_bg.body.padding.right = LV_DPI / 20;
|
|
|
|
slider_bg.body.padding.top = LV_DPI / 20;
|
|
|
|
slider_bg.body.padding.bottom = LV_DPI / 20;
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.slider.bg = &slider_bg;
|
|
|
|
theme.style.slider.indic = &lv_style_pretty_color;
|
|
|
|
theme.style.slider.knob = &lv_style_pretty;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sw_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_SW != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
lv_style_copy(&sw_bg, &lv_style_pretty);
|
2019-03-15 22:19:21 +01:00
|
|
|
sw_bg.body.padding.left = 3;
|
|
|
|
sw_bg.body.padding.right = 3;
|
|
|
|
sw_bg.body.padding.top = 3;
|
|
|
|
sw_bg.body.padding.bottom = 3;
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.sw.bg = &sw_bg;
|
|
|
|
theme.style.sw.indic = &lv_style_pretty_color;
|
|
|
|
theme.style.sw.knob_off = &lv_style_pretty;
|
|
|
|
theme.style.sw.knob_on = &lv_style_pretty;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void lmeter_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LMETER != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
lv_style_copy(&lmeter, &lv_style_pretty_color);
|
2017-11-23 21:28:36 +01:00
|
|
|
lmeter.line.color = LV_COLOR_HEX3(0xddd);
|
2017-12-07 19:22:23 +01:00
|
|
|
lmeter.line.width = 2;
|
2017-12-19 22:00:32 +01:00
|
|
|
lmeter.body.main_color = lv_color_mix(lmeter.body.main_color, LV_COLOR_WHITE, LV_OPA_50);
|
|
|
|
lmeter.body.grad_color = lv_color_mix(lmeter.body.grad_color, LV_COLOR_BLACK, LV_OPA_50);
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.lmeter = &lmeter;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gauge_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_GAUGE != 0
|
2017-12-19 22:00:32 +01:00
|
|
|
static lv_style_t gauge;
|
|
|
|
lv_style_copy(&gauge, &lmeter);
|
|
|
|
gauge.line.color = lmeter.body.grad_color;
|
2018-01-02 12:59:18 +01:00
|
|
|
gauge.line.width = 2;
|
2017-12-19 22:00:32 +01:00
|
|
|
gauge.body.main_color = LV_COLOR_HEX3(0x888);
|
|
|
|
gauge.body.grad_color = lmeter.body.main_color;
|
|
|
|
gauge.text.color = LV_COLOR_HEX3(0x888);
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.gauge = &gauge;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void chart_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CHART
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.chart = &lv_style_pretty;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cb_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CB != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.cb.bg = &lv_style_transp;
|
|
|
|
theme.style.cb.box.rel = &lv_style_pretty;
|
|
|
|
theme.style.cb.box.pr = &lv_style_btn_pr;
|
|
|
|
theme.style.cb.box.tgl_rel = &lv_style_btn_tgl_rel;
|
|
|
|
theme.style.cb.box.tgl_pr = &lv_style_btn_tgl_pr;
|
|
|
|
theme.style.cb.box.ina = &lv_style_btn_ina;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void btnm_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_BTNM
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.btnm.bg = &lv_style_pretty;
|
|
|
|
theme.style.btnm.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.btnm.btn.pr = &lv_style_btn_pr;
|
|
|
|
theme.style.btnm.btn.tgl_rel = &lv_style_btn_tgl_rel;
|
|
|
|
theme.style.btnm.btn.tgl_pr = &lv_style_btn_tgl_pr;
|
|
|
|
theme.style.btnm.btn.ina = &lv_style_btn_ina;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void kb_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_KB
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.kb.bg = &lv_style_pretty;
|
|
|
|
theme.style.kb.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.kb.btn.pr = &lv_style_btn_pr;
|
|
|
|
theme.style.kb.btn.tgl_rel = &lv_style_btn_tgl_rel;
|
|
|
|
theme.style.kb.btn.tgl_pr = &lv_style_btn_tgl_pr;
|
|
|
|
theme.style.kb.btn.ina = &lv_style_btn_ina;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mbox_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_MBOX
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.mbox.bg = &lv_style_pretty;
|
|
|
|
theme.style.mbox.btn.bg = &lv_style_transp;
|
|
|
|
theme.style.mbox.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.mbox.btn.pr = &lv_style_btn_tgl_pr;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void page_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_PAGE
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.page.bg = &lv_style_pretty;
|
|
|
|
theme.style.page.scrl = &lv_style_transp_tight;
|
|
|
|
theme.style.page.sb = &sb;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ta_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TA
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.ta.area = &lv_style_pretty;
|
|
|
|
theme.style.ta.oneline = &lv_style_pretty;
|
|
|
|
theme.style.ta.cursor = NULL;
|
|
|
|
theme.style.ta.sb = &sb;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void list_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_LIST != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.list.bg = &lv_style_pretty;
|
|
|
|
theme.style.list.scrl = &lv_style_transp_fit;
|
|
|
|
theme.style.list.sb = &sb;
|
|
|
|
theme.style.list.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.list.btn.pr = &lv_style_btn_pr;
|
|
|
|
theme.style.list.btn.tgl_rel = &lv_style_btn_tgl_rel;
|
|
|
|
theme.style.list.btn.tgl_pr = &lv_style_btn_tgl_pr;
|
|
|
|
theme.style.list.btn.ina = &lv_style_btn_ina;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ddlist_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_DDLIST != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.ddlist.bg = &lv_style_pretty;
|
|
|
|
theme.style.ddlist.sel = &lv_style_plain_color;
|
|
|
|
theme.style.ddlist.sb = &sb;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void roller_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_ROLLER != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.roller.bg = &lv_style_pretty;
|
|
|
|
theme.style.roller.sel = &lv_style_plain_color;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tabview_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TABVIEW != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.tabview.bg = &plain_bordered;
|
|
|
|
theme.style.tabview.indic = &lv_style_plain_color;
|
|
|
|
theme.style.tabview.btn.bg = &lv_style_transp;
|
|
|
|
theme.style.tabview.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.tabview.btn.pr = &lv_style_btn_pr;
|
|
|
|
theme.style.tabview.btn.tgl_rel = &lv_style_btn_tgl_rel;
|
|
|
|
theme.style.tabview.btn.tgl_pr = &lv_style_btn_tgl_pr;
|
2017-11-18 00:17:21 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void win_init(void)
|
|
|
|
{
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_WIN != 0
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
|
2019-02-11 09:35:06 +01:00
|
|
|
theme.style.win.bg = &plain_bordered;
|
|
|
|
theme.style.win.sb = &sb;
|
|
|
|
theme.style.win.header = &lv_style_plain_color;
|
|
|
|
theme.style.win.content.bg = &lv_style_transp;
|
|
|
|
theme.style.win.content.scrl = &lv_style_transp;
|
|
|
|
theme.style.win.btn.rel = &lv_style_btn_rel;
|
|
|
|
theme.style.win.btn.pr = &lv_style_btn_pr;
|
2017-11-18 00:17:21 +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-03 11:20:49 +01:00
|
|
|
static void style_mod(lv_group_t * group, lv_style_t * style)
|
2019-02-15 08:59:53 +01:00
|
|
|
{
|
2019-03-03 11:20:49 +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_ORANGE;
|
|
|
|
|
|
|
|
/*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_ORANGE, LV_OPA_70);
|
|
|
|
style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_ORANGE, LV_OPA_70);
|
|
|
|
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_ORANGE, LV_OPA_60);
|
|
|
|
|
|
|
|
style->text.color = lv_color_mix(style->text.color, LV_COLOR_ORANGE, LV_OPA_70);
|
|
|
|
#else
|
|
|
|
style->body.border.opa = LV_OPA_COVER;
|
|
|
|
style->body.border.color = LV_COLOR_BLACK;
|
|
|
|
style->body.border.width = 2;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-03-03 11:20:49 +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-03 11:20:49 +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-11-18 00:17:21 +01:00
|
|
|
/**********************
|
|
|
|
* GLOBAL FUNCTIONS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the default 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_default_init(uint16_t hue, lv_font_t * font)
|
2017-11-18 00:17:21 +01:00
|
|
|
{
|
2017-11-19 19:28:45 +01:00
|
|
|
if(font == NULL) font = LV_FONT_DEFAULT;
|
2017-11-18 00:17:21 +01:00
|
|
|
|
|
|
|
_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-11-18 00:17:21 +01:00
|
|
|
*style_p = &def;
|
|
|
|
style_p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
basic_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();
|
|
|
|
|
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-11-18 00:17:21 +01:00
|
|
|
return &theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a pointer to the theme
|
|
|
|
* @return pointer to the theme
|
|
|
|
*/
|
2017-11-22 23:04:02 +01:00
|
|
|
lv_theme_t * lv_theme_get_default(void)
|
2017-11-18 00:17:21 +01:00
|
|
|
{
|
|
|
|
return &theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC FUNCTIONS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|