mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
remove teh old themes
This commit is contained in:
parent
74d3c8b034
commit
220d98ffaa
@ -1,477 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_default.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t scr;
|
||||
|
||||
/*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;
|
||||
|
||||
/*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_pretty); /*Initialize the default style*/
|
||||
|
||||
lv_style_copy(&scr, &def);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&sb, &lv_style_pretty_color);
|
||||
sb.body.grad_color = sb.body.main_color;
|
||||
sb.body.padding.right = sb.body.padding.right / 2; /*Make closer to the edges*/
|
||||
sb.body.padding.bottom = sb.body.padding.bottom / 2;
|
||||
|
||||
lv_style_copy(&plain_bordered, &lv_style_plain);
|
||||
plain_bordered.body.border.width = 2;
|
||||
plain_bordered.body.border.color = lv_color_hex3(0xbbb);
|
||||
|
||||
theme.style.bg = &lv_style_plain;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &lv_style_pretty;
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
|
||||
lv_style_copy(&label_prim, &lv_style_plain);
|
||||
lv_style_copy(&label_sec, &lv_style_plain);
|
||||
lv_style_copy(&label_hint, &lv_style_plain);
|
||||
|
||||
label_prim.text.color = lv_color_hex3(0x111);
|
||||
label_sec.text.color = lv_color_hex3(0x888);
|
||||
label_hint.text.color = lv_color_hex3(0xaaa);
|
||||
|
||||
theme.style.label.prim = &label_prim;
|
||||
theme.style.label.sec = &label_sec;
|
||||
theme.style.label.hint = &label_hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_IMG != 0
|
||||
|
||||
theme.style.img.light = &def;
|
||||
theme.style.img.dark = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
|
||||
theme.style.line.decor = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_LED != 0
|
||||
static lv_style_t led;
|
||||
|
||||
lv_style_copy(&led, &lv_style_pretty_color);
|
||||
led.body.shadow.width = LV_DPI / 10;
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
led.body.border.width = LV_DPI / 30;
|
||||
led.body.border.opa = LV_OPA_30;
|
||||
led.body.shadow.color = led.body.main_color;
|
||||
|
||||
theme.style.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_BAR
|
||||
|
||||
theme.style.bar.bg = &lv_style_pretty;
|
||||
theme.style.bar.indic = &lv_style_pretty_color;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_SLIDER != 0
|
||||
static lv_style_t slider_bg;
|
||||
lv_style_copy(&slider_bg, &lv_style_pretty);
|
||||
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;
|
||||
|
||||
theme.style.slider.bg = &slider_bg;
|
||||
theme.style.slider.indic = &lv_style_pretty_color;
|
||||
theme.style.slider.knob = &lv_style_pretty;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
static lv_style_t sw_bg;
|
||||
lv_style_copy(&sw_bg, &lv_style_pretty);
|
||||
sw_bg.body.padding.left = 3;
|
||||
sw_bg.body.padding.right = 3;
|
||||
sw_bg.body.padding.top = 3;
|
||||
sw_bg.body.padding.bottom = 3;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_LMETER != 0
|
||||
static lv_style_t lmeter;
|
||||
lv_style_copy(&lmeter, &lv_style_pretty_color);
|
||||
lmeter.line.color = lv_color_hex3(0xddd);
|
||||
lmeter.line.width = 2;
|
||||
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);
|
||||
|
||||
theme.style.lmeter = &lmeter;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_GAUGE != 0
|
||||
static lv_style_t gauge;
|
||||
lv_style_copy(&gauge, theme.style.lmeter);
|
||||
gauge.line.color = theme.style.lmeter->body.grad_color;
|
||||
gauge.line.width = 2;
|
||||
gauge.body.main_color = lv_color_hex3(0x888);
|
||||
gauge.body.grad_color = theme.style.lmeter->body.main_color;
|
||||
gauge.text.color = lv_color_hex3(0x888);
|
||||
|
||||
theme.style.gauge = &gauge;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
|
||||
theme.style.chart = &lv_style_pretty;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
|
||||
theme.style.page.bg = &lv_style_pretty;
|
||||
theme.style.page.scrl = &lv_style_transp_tight;
|
||||
theme.style.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
|
||||
theme.style.ta.area = &lv_style_pretty;
|
||||
theme.style.ta.oneline = &lv_style_pretty;
|
||||
theme.style.ta.cursor = NULL;
|
||||
theme.style.ta.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
|
||||
theme.style.ddlist.bg = &lv_style_pretty;
|
||||
theme.style.ddlist.sel = &lv_style_plain_color;
|
||||
theme.style.ddlist.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_ROLLER != 0
|
||||
|
||||
theme.style.roller.bg = &lv_style_pretty;
|
||||
theme.style.roller.sel = &lv_style_plain_color;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 0
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABLE != 0
|
||||
theme.style.table.bg = &lv_style_transp_tight;
|
||||
theme.style.table.cell = &lv_style_plain;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
|
||||
theme.style.win.bg = &plain_bordered;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &lv_style_plain_color;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &lv_style_btn_rel;
|
||||
theme.style.win.btn.pr = &lv_style_btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* 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
|
||||
*/
|
||||
lv_theme_t * lv_theme_default_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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*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();
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_default(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_default.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_DEFAULT_H
|
||||
#define LV_THEME_DEFAULT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
lv_theme_t * lv_theme_default_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_default(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_TEMPL_H*/
|
@ -1,942 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_material.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_MATERIAL
|
||||
|
||||
/*********************
|
||||
* 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)
|
||||
{
|
||||
static lv_style_t bg, panel, scr;
|
||||
|
||||
lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/
|
||||
def.text.font = _font;
|
||||
def.body.radius = DEF_RADIUS;
|
||||
|
||||
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(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = DEF_RADIUS;
|
||||
panel.body.main_color = LV_COLOR_WHITE;
|
||||
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.width = 6;
|
||||
panel.body.shadow.offset.y = 2;
|
||||
panel.body.padding.left = LV_DPI / 8;
|
||||
panel.body.padding.right = LV_DPI / 8;
|
||||
panel.body.padding.top = LV_DPI / 8;
|
||||
panel.body.padding.bottom = LV_DPI / 8;
|
||||
panel.body.padding.inner = LV_DPI / 12;
|
||||
panel.text.color = lv_color_hex3(0x333);
|
||||
panel.image.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;
|
||||
sb.body.padding.right = LV_DPI / 25;
|
||||
sb.body.padding.bottom = LV_DPI / 25;
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
|
||||
theme.style.cont = theme.style.panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_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.left = LV_DPI / 6;
|
||||
rel.body.padding.right = LV_DPI / 6;
|
||||
rel.body.padding.top = LV_DPI / 8;
|
||||
rel.body.padding.bottom = LV_DPI / 8;
|
||||
rel.body.padding.inner = LV_DPI / 10;
|
||||
rel.body.shadow.color = DEF_SHADOW_COLOR;
|
||||
rel.body.shadow.width = 6;
|
||||
rel.body.shadow.offset.y = 2;
|
||||
rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
rel.image.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);
|
||||
ina.image.color = lv_color_hsv_to_rgb(_hue, 95, 5);
|
||||
|
||||
theme.style.btn.rel = &rel;
|
||||
theme.style.btn.pr = ≺
|
||||
theme.style.btn.tgl_rel = &tgl_rel;
|
||||
theme.style.btn.tgl_pr = &tgl_pr;
|
||||
theme.style.btn.ina = &ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_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.style.label.prim = &prim;
|
||||
theme.style.label.sec = &sec;
|
||||
theme.style.label.hint = &hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_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.style.img.light = &def;
|
||||
theme.style.img.dark = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
|
||||
theme.style.line.decor = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_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.style.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_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.left = LV_DPI / 16;
|
||||
bar_bg.body.padding.right = LV_DPI / 16;
|
||||
bar_bg.body.padding.top = LV_DPI / 16;
|
||||
bar_bg.body.padding.bottom = LV_DPI / 16;
|
||||
|
||||
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.left = 0;
|
||||
bar_indic.body.padding.right = 0;
|
||||
bar_indic.body.padding.top = 0;
|
||||
bar_indic.body.padding.bottom = 0;
|
||||
|
||||
theme.style.bar.bg = &bar_bg;
|
||||
theme.style.bar.indic = &bar_indic;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_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.style.bar.indic->body.main_color;
|
||||
knob.body.grad_color = knob.body.main_color;
|
||||
knob.body.padding.left = LV_DPI/25;
|
||||
knob.body.padding.right = LV_DPI/25;
|
||||
knob.body.padding.top = LV_DPI/25;
|
||||
knob.body.padding.bottom = LV_DPI/25;
|
||||
|
||||
theme.style.slider.bg = theme.style.bar.bg;
|
||||
theme.style.slider.indic = theme.style.bar.indic;
|
||||
theme.style.slider.knob = &knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
static lv_style_t sw_bg, sw_indic, sw_knob_off, sw_knob_on;
|
||||
lv_style_copy(&sw_bg, theme.style.slider.bg);
|
||||
sw_bg.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
lv_style_copy(&sw_indic, theme.style.slider.bg);
|
||||
sw_indic.body.radius = LV_RADIUS_CIRCLE;
|
||||
sw_indic.body.padding.left = 0;
|
||||
sw_indic.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&sw_knob_on, theme.style.slider.knob);
|
||||
sw_knob_on.body.shadow.width = 5;
|
||||
sw_knob_on.body.shadow.color = DEF_SHADOW_COLOR;
|
||||
sw_knob_on.body.shadow.offset.y= 3;
|
||||
|
||||
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.style.sw.bg = &sw_bg;
|
||||
theme.style.sw.indic = &sw_indic;
|
||||
theme.style.sw.knob_off = &sw_knob_off;
|
||||
theme.style.sw.knob_on = &sw_knob_on;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_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.left = LV_DPI / 10; /*Scale line length*/
|
||||
lmeter.line.color = lv_color_hex3(0x999);
|
||||
lmeter.line.width = 2;
|
||||
|
||||
theme.style.lmeter = &lmeter;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_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.left = 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.style.gauge = &gauge;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void arc_init(void)
|
||||
{
|
||||
#if LV_USE_ARC != 0
|
||||
|
||||
static lv_style_t arc;
|
||||
lv_style_copy(&arc, &def);
|
||||
arc.line.width = 10;
|
||||
arc.line.color = lv_color_hsv_to_rgb(_hue, 90, 90);
|
||||
|
||||
/*For prelaoder*/
|
||||
arc.body.border.width = 10;
|
||||
arc.body.border.color = lv_color_hsv_to_rgb(_hue, 30, 90);
|
||||
arc.body.padding.left = 0;
|
||||
arc.body.padding.right = 0;
|
||||
arc.body.padding.top = 0;
|
||||
arc.body.padding.bottom = 0;
|
||||
|
||||
theme.style.arc = &arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void preload_init(void)
|
||||
{
|
||||
#if LV_USE_SPINNER != 0
|
||||
|
||||
theme.style.preload = theme.style.arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
theme.style.chart = theme.style.panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR
|
||||
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, 80, 90);
|
||||
|
||||
static lv_style_t week_box;
|
||||
lv_style_copy(&week_box, &def);
|
||||
week_box.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 100);
|
||||
week_box.body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 100);
|
||||
week_box.body.padding.top = LV_DPI / 20;
|
||||
week_box.body.padding.bottom = LV_DPI / 20;
|
||||
week_box.body.padding.left = theme.style.panel->body.padding.left;
|
||||
week_box.body.padding.right = theme.style.panel->body.padding.right;
|
||||
week_box.body.border.color = theme.style.panel->body.border.color;
|
||||
week_box.body.border.width = theme.style.panel->body.border.width;
|
||||
week_box.body.border.part = LV_BORDER_PART_LEFT | LV_BORDER_PART_RIGHT;
|
||||
week_box.body.radius = 0;
|
||||
|
||||
static lv_style_t today_box;
|
||||
lv_style_copy(&today_box, &def);
|
||||
today_box.body.main_color = LV_COLOR_WHITE;
|
||||
today_box.body.grad_color = LV_COLOR_WHITE;
|
||||
today_box.body.padding.top = LV_DPI / 20;
|
||||
today_box.body.padding.bottom = LV_DPI / 20;
|
||||
today_box.body.radius = 0;
|
||||
|
||||
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 = &week_box;
|
||||
theme.style.calendar.today_box = &today_box;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
|
||||
lv_style_copy(&rel, theme.style.panel);
|
||||
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.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.style.btn.ina);
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&bg, theme.style.panel);
|
||||
bg.body.padding.left = 0;
|
||||
bg.body.padding.right = 0;
|
||||
bg.body.padding.top = 0;
|
||||
bg.body.padding.bottom = 0;
|
||||
bg.body.padding.inner = 0;
|
||||
bg.text.color = lv_color_hex3(0x555);
|
||||
|
||||
lv_style_copy(&rel, theme.style.panel);
|
||||
rel.body.border.part = LV_BORDER_PART_FULL | LV_BORDER_PART_INTERNAL;
|
||||
rel.body.border.width = 1;
|
||||
rel.body.border.color = lv_color_hex3(0xbbb);
|
||||
rel.body.opa = LV_OPA_TRANSP;
|
||||
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.opa = LV_OPA_COVER;
|
||||
|
||||
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.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 = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
|
||||
static lv_style_t rel;
|
||||
lv_style_copy(&rel, &lv_style_transp);
|
||||
rel.text.font = _font;
|
||||
|
||||
theme.style.kb.bg = theme.style.btnm.bg;
|
||||
theme.style.kb.btn.rel = &rel;
|
||||
theme.style.kb.btn.pr = theme.style.btnm.btn.pr;
|
||||
theme.style.kb.btn.tgl_rel = theme.style.btnm.btn.tgl_rel;
|
||||
theme.style.kb.btn.tgl_pr = theme.style.btnm.btn.tgl_pr;
|
||||
theme.style.kb.btn.ina = theme.style.btnm.btn.ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
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.style.btnm.btn.pr);
|
||||
pr.text.color = lv_color_hsv_to_rgb(_hue, 85, 60);
|
||||
|
||||
theme.style.mbox.bg = theme.style.panel;
|
||||
theme.style.mbox.btn.bg = &lv_style_transp;
|
||||
theme.style.mbox.btn.rel = &rel;
|
||||
theme.style.mbox.btn.pr = ≺
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
|
||||
theme.style.page.bg = theme.style.panel;
|
||||
theme.style.page.scrl = &lv_style_transp;
|
||||
theme.style.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
static lv_style_t oneline;
|
||||
|
||||
lv_style_copy(&oneline, &def);
|
||||
oneline.body.opa = LV_OPA_TRANSP;
|
||||
oneline.body.radius = 0;
|
||||
oneline.body.border.part = LV_BORDER_PART_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.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 = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void spinbox_init(void)
|
||||
{
|
||||
#if LV_USE_SPINBOX
|
||||
theme.style.spinbox.bg = theme.style.panel;
|
||||
theme.style.spinbox.cursor = theme.style.ta.cursor;
|
||||
theme.style.spinbox.sb = theme.style.ta.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
|
||||
static lv_style_t list_bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&list_bg, theme.style.panel);
|
||||
list_bg.body.padding.left = 0;
|
||||
list_bg.body.padding.right = 0;
|
||||
list_bg.body.padding.top = 0;
|
||||
list_bg.body.padding.bottom = 0;
|
||||
list_bg.body.padding.inner = 0;
|
||||
|
||||
lv_style_copy(&rel, &lv_style_transp);
|
||||
rel.body.padding.left = LV_DPI / 8;
|
||||
rel.body.padding.right = LV_DPI / 8;
|
||||
rel.body.padding.top = LV_DPI / 6;
|
||||
rel.body.padding.bottom = 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_PART_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.opa = LV_OPA_COVER;
|
||||
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.style.list.sb = &sb;
|
||||
theme.style.list.bg = &list_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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
static lv_style_t bg, sel;
|
||||
lv_style_copy(&bg, theme.style.panel);
|
||||
bg.body.padding.left = LV_DPI / 6;
|
||||
bg.body.padding.right = LV_DPI / 6;
|
||||
bg.body.padding.top = LV_DPI / 6;
|
||||
bg.body.padding.bottom = 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.style.ddlist.bg = &bg;
|
||||
theme.style.ddlist.sel = &sel;
|
||||
theme.style.ddlist.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_ROLLER != 0
|
||||
static lv_style_t roller_bg, roller_sel;
|
||||
|
||||
lv_style_copy(&roller_bg, &lv_style_transp);
|
||||
roller_bg.body.padding.left = LV_DPI / 6;
|
||||
roller_bg.body.padding.right = LV_DPI / 6;
|
||||
roller_bg.body.padding.top = LV_DPI / 6;
|
||||
roller_bg.body.padding.bottom = 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.style.roller.bg = &roller_bg;
|
||||
theme.style.roller.sel = &roller_sel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 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_PART_BOTTOM;
|
||||
btn_bg.body.border.opa = LV_OPA_COVER;
|
||||
btn_bg.body.shadow.width = 5;
|
||||
btn_bg.body.shadow.spread = 2;
|
||||
btn_bg.body.shadow.offset.y = 1;
|
||||
btn_bg.body.shadow.color = DEF_SHADOW_COLOR;
|
||||
btn_bg.body.padding.inner = 0;
|
||||
btn_bg.body.padding.left = 0;
|
||||
btn_bg.body.padding.right = 0;
|
||||
btn_bg.body.padding.top = 0;
|
||||
btn_bg.body.padding.bottom = 0;
|
||||
btn_bg.text.color = lv_color_hex3(0x333);
|
||||
|
||||
lv_style_copy(&rel, &lv_style_transp);
|
||||
rel.body.padding.top = LV_DPI / 8;
|
||||
rel.body.padding.bottom = 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.opa = LV_OPA_COVER;
|
||||
pr.body.radius = 0;
|
||||
pr.body.border.width = 1;
|
||||
pr.body.border.color = lv_color_hex3(0x888);
|
||||
pr.body.border.part = LV_BORDER_PART_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.opa = LV_OPA_COVER;
|
||||
tgl_pr.body.radius = 0;
|
||||
tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 90, 60);
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
theme.style.tileview.bg = &lv_style_transp_tight;
|
||||
theme.style.tileview.scrl = &lv_style_transp_tight;
|
||||
theme.style.tileview.sb = theme.style.page.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABLE != 0
|
||||
static lv_style_t cell;
|
||||
lv_style_copy(&cell, theme.style.panel);
|
||||
cell.body.radius = 0;
|
||||
cell.body.border.width = 1;
|
||||
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;
|
||||
cell.body.shadow.width = 0;
|
||||
|
||||
theme.style.table.bg = &lv_style_transp_tight;
|
||||
theme.style.table.cell = &cell;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_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 = 0;
|
||||
header.body.border.width = 1;
|
||||
header.body.border.color = lv_color_hex3(0xbbb);
|
||||
header.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||
header.body.border.opa = LV_OPA_COVER;
|
||||
header.body.padding.inner = 0;
|
||||
header.body.padding.left = 0;
|
||||
header.body.padding.right = 0;
|
||||
header.body.padding.top = 0;
|
||||
header.body.padding.bottom = 0;
|
||||
header.text.color = lv_color_hex3(0x333);
|
||||
header.image.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.opa = LV_OPA_COVER;
|
||||
pr.body.radius = 0;
|
||||
pr.text.color = lv_color_hex3(0x111);
|
||||
pr.image.color = lv_color_hex3(0x111);
|
||||
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &lv_style_transp;
|
||||
theme.style.win.btn.pr = ≺
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
uint16_t hue2 = (_hue + 60) % 360;
|
||||
|
||||
/*Make the style to be a little bit orange*/
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = lv_color_hsv_to_rgb(hue2, 90, 70);
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 30;
|
||||
|
||||
style->body.main_color = lv_color_mix(style->body.main_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
|
||||
style->body.grad_color = lv_color_mix(style->body.grad_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
|
||||
style->body.shadow.color = lv_color_mix(style->body.shadow.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_60);
|
||||
|
||||
style->text.color = lv_color_mix(style->text.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
uint16_t hue2 = (_hue + 300) % 360;
|
||||
|
||||
/*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*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 30;
|
||||
|
||||
|
||||
style->body.main_color = lv_color_mix(style->body.main_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
|
||||
style->body.grad_color = lv_color_mix(style->body.grad_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
|
||||
style->body.shadow.color = lv_color_mix(style->body.shadow.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_60);
|
||||
|
||||
style->text.color = lv_color_mix(style->text.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* 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_material_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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; 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();
|
||||
arc_init();
|
||||
preload_init();
|
||||
calendar_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
spinbox_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
tileview_init();
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_material(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_material.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_MATERIAL_H
|
||||
#define LV_THEME_MATERIAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_THEME_MATERIAL
|
||||
|
||||
/*********************
|
||||
* 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_material_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_material(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_MATERIAL_H*/
|
@ -1,524 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_templ.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_MONO
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t scr;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t light_plain;
|
||||
static lv_style_t dark_plain;
|
||||
static lv_style_t light_frame;
|
||||
static lv_style_t dark_frame;
|
||||
|
||||
/*Saved input parameters*/
|
||||
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.body.main_color = LV_COLOR_WHITE;
|
||||
def.body.grad_color = LV_COLOR_WHITE;
|
||||
def.body.radius = 0;
|
||||
def.body.opa = LV_OPA_COVER;
|
||||
def.body.padding.left = LV_DPI / 10;
|
||||
def.body.padding.right = LV_DPI / 10;
|
||||
def.body.padding.top = LV_DPI / 10;
|
||||
def.body.padding.bottom = LV_DPI / 10;
|
||||
def.body.padding.inner = LV_DPI / 10;
|
||||
def.body.border.color = LV_COLOR_BLACK;
|
||||
def.body.border.width = 1;
|
||||
def.body.border.opa = LV_OPA_COVER;
|
||||
def.body.border.part = LV_BORDER_PART_FULL;
|
||||
|
||||
def.text.font = _font;
|
||||
def.text.color = LV_COLOR_BLACK;
|
||||
def.text.letter_space = 1;
|
||||
def.text.line_space = 1;
|
||||
|
||||
def.line.color = LV_COLOR_BLACK;
|
||||
def.line.opa = LV_OPA_COVER;
|
||||
def.line.width = 1;
|
||||
|
||||
def.image.color = LV_COLOR_BLACK;
|
||||
def.image.intense = LV_OPA_TRANSP;
|
||||
def.image.opa = LV_OPA_COVER;
|
||||
|
||||
lv_style_copy(&light_plain, &def);
|
||||
|
||||
lv_style_copy(&scr, &light_plain);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&light_frame, &light_plain);
|
||||
light_frame.body.radius = LV_DPI / 20;
|
||||
|
||||
lv_style_copy(&dark_plain, &light_plain);
|
||||
dark_plain.body.main_color = LV_COLOR_BLACK;
|
||||
dark_plain.body.grad_color = LV_COLOR_BLACK;
|
||||
dark_plain.body.border.color = LV_COLOR_WHITE;
|
||||
dark_plain.text.color = LV_COLOR_WHITE;
|
||||
dark_plain.line.color = LV_COLOR_WHITE;
|
||||
dark_plain.image.color = LV_COLOR_WHITE;
|
||||
|
||||
lv_style_copy(&dark_frame, &dark_plain);
|
||||
dark_frame.body.radius = LV_DPI / 20;
|
||||
|
||||
theme.style.bg = &def;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &light_frame;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
|
||||
theme.style.cont = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
|
||||
theme.style.btn.rel = &light_frame;
|
||||
theme.style.btn.pr = &dark_frame;
|
||||
theme.style.btn.tgl_rel = &dark_frame;
|
||||
theme.style.btn.tgl_pr = &light_frame;
|
||||
theme.style.btn.ina = &light_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
|
||||
theme.style.label.prim = &light_plain;
|
||||
theme.style.label.sec = &light_plain;
|
||||
theme.style.label.hint = &light_plain;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_IMG != 0
|
||||
|
||||
theme.style.img.light = &def;
|
||||
theme.style.img.dark = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
theme.style.line.decor = &light_plain;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_LED != 0
|
||||
static lv_style_t led;
|
||||
lv_style_copy(&led, &light_frame);
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
led.body.shadow.width = LV_DPI / 8;
|
||||
led.body.shadow.color = LV_COLOR_BLACK;
|
||||
|
||||
theme.style.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_BAR
|
||||
static lv_style_t bar_bg;
|
||||
static lv_style_t bar_indic;
|
||||
|
||||
lv_style_copy(&bar_bg, &light_frame);
|
||||
bar_bg.body.padding.left = LV_DPI / 15;
|
||||
bar_bg.body.padding.right = LV_DPI / 15;
|
||||
bar_bg.body.padding.top = LV_DPI / 15;
|
||||
bar_bg.body.padding.bottom = LV_DPI / 15;
|
||||
bar_bg.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
lv_style_copy(&bar_indic, &dark_frame);
|
||||
bar_indic.body.padding.left = LV_DPI / 30;
|
||||
bar_indic.body.padding.right = LV_DPI / 30;
|
||||
bar_indic.body.padding.top = LV_DPI / 30;
|
||||
bar_indic.body.padding.bottom = LV_DPI / 30;
|
||||
bar_indic.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
theme.style.bar.bg = &bar_bg;
|
||||
theme.style.bar.indic = &bar_indic;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_SLIDER != 0
|
||||
static lv_style_t slider_knob;
|
||||
lv_style_copy(&slider_knob, &light_frame);
|
||||
slider_knob.body.radius = LV_RADIUS_CIRCLE;
|
||||
slider_knob.body.padding.left = LV_DPI / 30;
|
||||
slider_knob.body.padding.right = LV_DPI / 30;
|
||||
slider_knob.body.padding.top = LV_DPI / 30;
|
||||
slider_knob.body.padding.bottom = LV_DPI / 30;
|
||||
|
||||
theme.style.slider.bg = theme.style.bar.bg;
|
||||
theme.style.slider.indic = theme.style.bar.indic;
|
||||
theme.style.slider.knob = &slider_knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
|
||||
theme.style.sw.bg = theme.style.slider.bg;
|
||||
theme.style.sw.indic = theme.style.slider.indic;
|
||||
theme.style.sw.knob_off = theme.style.slider.knob;
|
||||
theme.style.sw.knob_on = theme.style.slider.knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_LMETER != 0
|
||||
static lv_style_t lmeter_bg;
|
||||
lv_style_copy(&lmeter_bg, &light_frame);
|
||||
lmeter_bg.body.opa = LV_OPA_TRANSP;
|
||||
lmeter_bg.body.main_color = LV_COLOR_BLACK;
|
||||
lmeter_bg.body.grad_color = LV_COLOR_BLACK;
|
||||
lmeter_bg.body.padding.left = LV_DPI / 20;
|
||||
lmeter_bg.body.padding.inner = LV_DPI / 8;
|
||||
lmeter_bg.line.color = LV_COLOR_WHITE;
|
||||
lmeter_bg.line.width = 1;
|
||||
|
||||
theme.style.lmeter = &lmeter_bg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_GAUGE != 0
|
||||
static lv_style_t gauge_bg;
|
||||
lv_style_copy(&gauge_bg, theme.style.lmeter);
|
||||
gauge_bg.line.color = LV_COLOR_BLACK;
|
||||
gauge_bg.line.width = 1;
|
||||
|
||||
theme.style.gauge = &gauge_bg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
theme.style.chart = &light_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR
|
||||
static lv_style_t box;
|
||||
lv_style_copy(&box, &light_plain);
|
||||
box.body.padding.top = LV_DPI / 20;
|
||||
box.body.padding.bottom = LV_DPI / 20;
|
||||
|
||||
/*Can't handle highlighted dates in this theme*/
|
||||
theme.style.calendar.week_box = &box;
|
||||
theme.style.calendar.today_box = &box;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
|
||||
theme.style.cb.bg = &lv_style_transp;
|
||||
theme.style.cb.box.rel = &light_frame;
|
||||
theme.style.cb.box.pr = &dark_frame;
|
||||
theme.style.cb.box.tgl_rel = &dark_frame;
|
||||
theme.style.cb.box.tgl_pr = &light_frame;
|
||||
theme.style.cb.box.ina = &light_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
|
||||
theme.style.btnm.bg = &light_frame;
|
||||
theme.style.btnm.btn.rel = &light_frame;
|
||||
theme.style.btnm.btn.pr = &dark_frame;
|
||||
theme.style.btnm.btn.tgl_rel = &dark_frame;
|
||||
theme.style.btnm.btn.tgl_pr = &light_frame;
|
||||
theme.style.btnm.btn.ina = &light_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
theme.style.kb.bg = &lv_style_transp_fit;
|
||||
theme.style.kb.btn.rel = &light_frame;
|
||||
theme.style.kb.btn.pr = &light_frame;
|
||||
theme.style.kb.btn.tgl_rel = &dark_frame;
|
||||
theme.style.kb.btn.tgl_pr = &dark_frame;
|
||||
theme.style.kb.btn.ina = &light_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
|
||||
theme.style.mbox.bg = &dark_frame;
|
||||
theme.style.mbox.btn.bg = &lv_style_transp_fit;
|
||||
theme.style.mbox.btn.rel = &light_frame;
|
||||
theme.style.mbox.btn.pr = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
|
||||
theme.style.page.bg = &light_frame;
|
||||
theme.style.page.scrl = &light_frame;
|
||||
theme.style.page.sb = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
|
||||
theme.style.ta.area = &light_frame;
|
||||
theme.style.ta.oneline = &light_frame;
|
||||
theme.style.ta.cursor = NULL; /*Let library to calculate the cursor's style*/
|
||||
theme.style.ta.sb = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
|
||||
theme.style.list.sb = &dark_frame;
|
||||
theme.style.list.bg = &light_frame;
|
||||
theme.style.list.scrl = &lv_style_transp_fit;
|
||||
theme.style.list.btn.rel = &light_plain;
|
||||
theme.style.list.btn.pr = &dark_plain;
|
||||
theme.style.list.btn.tgl_rel = &dark_plain;
|
||||
theme.style.list.btn.tgl_pr = &light_plain;
|
||||
theme.style.list.btn.ina = &light_plain;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
static lv_style_t bg;
|
||||
lv_style_copy(&bg, &light_frame);
|
||||
bg.text.line_space = LV_DPI / 12;
|
||||
|
||||
theme.style.ddlist.bg = &bg;
|
||||
theme.style.ddlist.sel = &dark_plain;
|
||||
theme.style.ddlist.sb = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_ROLLER != 0
|
||||
static lv_style_t bg;
|
||||
lv_style_copy(&bg, &light_frame);
|
||||
bg.text.line_space = LV_DPI / 12;
|
||||
|
||||
theme.style.roller.bg = &bg;
|
||||
theme.style.roller.sel = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 0
|
||||
|
||||
theme.style.tabview.bg = &light_frame;
|
||||
theme.style.tabview.indic = &light_plain;
|
||||
theme.style.tabview.btn.bg = &lv_style_transp_fit;
|
||||
theme.style.tabview.btn.rel = &light_frame;
|
||||
theme.style.tabview.btn.pr = &dark_frame;
|
||||
theme.style.tabview.btn.tgl_rel = &dark_frame;
|
||||
theme.style.tabview.btn.tgl_pr = &light_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
static lv_style_t win_header;
|
||||
lv_style_copy(&win_header, &dark_plain);
|
||||
win_header.body.padding.left = LV_DPI / 30;
|
||||
win_header.body.padding.right = LV_DPI / 30;
|
||||
win_header.body.padding.top = LV_DPI / 30;
|
||||
win_header.body.padding.bottom = LV_DPI / 30;
|
||||
|
||||
theme.style.win.bg = &light_frame;
|
||||
theme.style.win.sb = &dark_frame;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &light_frame;
|
||||
theme.style.win.btn.pr = &dark_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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_BLACK;
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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_BLACK;
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the mono theme
|
||||
* @param hue [0..360] hue value from HSV color space to define the theme's base color; is not used
|
||||
* in lv_theme_mono
|
||||
* @param font pointer to a font (NULL to use the default)
|
||||
* @return pointer to the initialized theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font)
|
||||
{
|
||||
|
||||
(void)hue; /*Unused*/
|
||||
|
||||
if(font == NULL) font = LV_FONT_DEFAULT;
|
||||
|
||||
_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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; 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();
|
||||
calendar_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_mono(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_mono.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_MONO_H
|
||||
#define LV_THEME_MONO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_THEME_MONO
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the mono 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_mono_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_mono(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_MONO_H*/
|
@ -1,928 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_nemo.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_NEMO
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
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 scr;
|
||||
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||
|
||||
#if LV_USE_BAR
|
||||
static lv_style_t bar_bg, bar_indic;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
static lv_style_t slider_knob;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LMETER
|
||||
static lv_style_t lmeter_bg;
|
||||
#endif
|
||||
|
||||
#if LV_USE_DROPDOWN
|
||||
static lv_style_t ddlist_bg, ddlist_sel;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTNMATRIX
|
||||
static lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_trel, btnm_ina;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void basic_init(void)
|
||||
{
|
||||
/*Default*/
|
||||
lv_style_copy(&def, &lv_style_plain);
|
||||
def.body.opa = LV_OPA_COVER;
|
||||
def.glass = 0;
|
||||
|
||||
def.body.main_color = lv_color_hex3(0x222);
|
||||
def.body.grad_color = lv_color_hex3(0x222);
|
||||
def.body.radius = 0;
|
||||
def.body.padding.left = LV_DPI / 8;
|
||||
def.body.padding.right = LV_DPI / 8;
|
||||
def.body.padding.top = LV_DPI / 8;
|
||||
def.body.padding.bottom = 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.text.color = lv_color_hex3(0xDDD);
|
||||
def.text.font = _font;
|
||||
def.text.letter_space = 1;
|
||||
def.text.line_space = 2;
|
||||
|
||||
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_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;
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
/*Panel*/
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
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.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.left = 1;
|
||||
sb.body.padding.right = 1;
|
||||
sb.body.padding.top = 1;
|
||||
sb.body.padding.bottom = 1;
|
||||
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
lv_style_copy(&btn_rel, &def);
|
||||
btn_rel.glass = 0;
|
||||
btn_rel.body.opa = LV_OPA_TRANSP;
|
||||
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.left = LV_DPI / 4;
|
||||
btn_rel.body.padding.right = LV_DPI / 4;
|
||||
btn_rel.body.padding.top = LV_DPI / 6;
|
||||
btn_rel.body.padding.bottom = 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(&btn_pr, &btn_rel);
|
||||
btn_pr.body.opa = LV_OPA_COVER;
|
||||
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.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(&btn_tpr, &btn_trel);
|
||||
btn_tpr.body.opa = LV_OPA_COVER;
|
||||
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(&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);
|
||||
|
||||
theme.style.btn.rel = &btn_rel;
|
||||
theme.style.btn.pr = &btn_pr;
|
||||
theme.style.btn.tgl_rel = &btn_trel;
|
||||
theme.style.btn.tgl_pr = &btn_tpr;
|
||||
theme.style.btn.ina = &btn_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
static lv_style_t label_prim, label_sec, label_hint;
|
||||
|
||||
lv_style_copy(&label_prim, &def);
|
||||
label_prim.text.font = _font;
|
||||
label_prim.text.color = lv_color_hsv_to_rgb(_hue, 5, 96);
|
||||
|
||||
lv_style_copy(&label_sec, &label_prim);
|
||||
label_sec.text.color = lv_color_hsv_to_rgb(_hue, 40, 85);
|
||||
|
||||
lv_style_copy(&label_hint, &label_prim);
|
||||
label_hint.text.color = lv_color_hsv_to_rgb(_hue, 20, 70);
|
||||
|
||||
theme.style.label.prim = &label_prim;
|
||||
theme.style.label.sec = &label_sec;
|
||||
theme.style.label.hint = &label_hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_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.left = 0;
|
||||
bar_bg.body.padding.right = 0;
|
||||
bar_bg.body.padding.top = LV_DPI / 10;
|
||||
bar_bg.body.padding.bottom = 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.left = 0;
|
||||
bar_indic.body.padding.right = 0;
|
||||
bar_indic.body.padding.top = 0;
|
||||
bar_indic.body.padding.bottom = 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.style.bar.bg = &bar_bg;
|
||||
theme.style.bar.indic = &bar_indic;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_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.style.img.light = &img_light;
|
||||
theme.style.img.dark = &img_dark;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_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.style.line.decor = &line_decor;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_LED != 0
|
||||
static lv_style_t led;
|
||||
lv_style_copy(&led, &lv_style_pretty_color);
|
||||
led.body.shadow.width = LV_DPI / 10;
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
led.body.border.width = LV_DPI / 30;
|
||||
led.body.border.opa = 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, 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.style.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_SLIDER != 0
|
||||
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;
|
||||
|
||||
theme.style.slider.bg = &bar_bg;
|
||||
theme.style.slider.indic = &bar_indic;
|
||||
theme.style.slider.knob = &slider_knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
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.left = -2;
|
||||
sw_bg.body.padding.right = -2;
|
||||
sw_bg.body.padding.top = -2;
|
||||
sw_bg.body.padding.bottom = -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, &bar_indic);
|
||||
sw_indic.body.shadow.width = LV_DPI / 20;
|
||||
sw_indic.body.padding.left = 0;
|
||||
sw_indic.body.padding.right = 0;
|
||||
sw_indic.body.padding.top = 0;
|
||||
sw_indic.body.padding.bottom = 0;
|
||||
|
||||
lv_style_copy(&sw_knob, &slider_knob);
|
||||
sw_knob.body.opa = LV_OPA_80;
|
||||
|
||||
theme.style.sw.bg = &sw_bg;
|
||||
theme.style.sw.indic = &sw_indic;
|
||||
theme.style.sw.knob_off = &sw_knob;
|
||||
theme.style.sw.knob_on = &sw_knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_LMETER != 0
|
||||
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.left = LV_DPI / 8; /*Scale line length*/
|
||||
lmeter_bg.line.color = lv_color_hex3(0x500);
|
||||
lmeter_bg.line.width = 2;
|
||||
|
||||
theme.style.lmeter = &lmeter_bg;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_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.left = LV_DPI / 16; /*Scale line length*/
|
||||
gauge_bg.body.padding.right = LV_DPI / 16; /*Scale line length*/
|
||||
gauge_bg.body.padding.top = LV_DPI / 20; /*Needle center size*/
|
||||
gauge_bg.body.padding.bottom = 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;
|
||||
|
||||
theme.style.gauge = &gauge_bg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void arc_init(void)
|
||||
{
|
||||
#if LV_USE_ARC != 0
|
||||
|
||||
static lv_style_t arc;
|
||||
lv_style_copy(&arc, &def);
|
||||
arc.line.width = 10;
|
||||
arc.line.color = lv_color_hsv_to_rgb(_hue, 70, 90);
|
||||
arc.line.rounded = 1;
|
||||
|
||||
/*For spinner*/
|
||||
arc.body.border.width = 0;
|
||||
|
||||
theme.style.arc = &arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void preload_init(void)
|
||||
{
|
||||
#if LV_USE_SPINNER != 0
|
||||
|
||||
theme.style.preload = theme.style.arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
theme.style.chart = &panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR != 0
|
||||
static lv_style_t ina_days;
|
||||
lv_style_copy(&ina_days, &def);
|
||||
ina_days.text.color = lv_color_hsv_to_rgb(_hue, 0, 50);
|
||||
|
||||
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 week_box;
|
||||
lv_style_copy(&week_box, &def);
|
||||
week_box.body.opa = LV_OPA_TRANSP;
|
||||
week_box.body.border.color = theme.style.panel->body.border.color;
|
||||
week_box.body.padding.top = LV_DPI / 20;
|
||||
week_box.body.padding.bottom = LV_DPI / 20;
|
||||
|
||||
static lv_style_t today_box;
|
||||
lv_style_copy(&today_box, &def);
|
||||
today_box.body.main_color = LV_COLOR_WHITE;
|
||||
today_box.body.grad_color = LV_COLOR_WHITE;
|
||||
today_box.body.padding.top = LV_DPI / 20;
|
||||
today_box.body.padding.bottom = LV_DPI / 20;
|
||||
today_box.body.radius = 0;
|
||||
|
||||
theme.style.calendar.bg = theme.style.panel;
|
||||
theme.style.calendar.header = theme.style.label.prim;
|
||||
theme.style.calendar.inactive_days = theme.style.label.hint;
|
||||
theme.style.calendar.highlighted_days = theme.style.label.sec;
|
||||
theme.style.calendar.week_box = &week_box;
|
||||
theme.style.calendar.today_box = &week_box;
|
||||
theme.style.calendar.header_pr = theme.style.label.prim;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
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(&cb_bg, &bg);
|
||||
cb_bg.body.opa = LV_OPA_TRANSP;
|
||||
cb_bg.body.border.width = 0;
|
||||
cb_bg.body.padding.inner = LV_DPI / 8;
|
||||
cb_bg.body.padding.left = 0;
|
||||
cb_bg.body.padding.right = 0;
|
||||
cb_bg.body.padding.top = 0;
|
||||
cb_bg.body.padding.bottom = 0;
|
||||
cb_bg.text.font = _font;
|
||||
|
||||
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(&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(&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);
|
||||
|
||||
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.style.cb.bg = &cb_bg;
|
||||
theme.style.cb.box.rel = &cb_rel;
|
||||
theme.style.cb.box.pr = &cb_pr;
|
||||
theme.style.cb.box.tgl_rel = &cb_trel;
|
||||
theme.style.cb.box.tgl_pr = &cb_tpr;
|
||||
theme.style.cb.box.ina = &cb_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
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(&btnm_rel, &lv_style_plain);
|
||||
btnm_rel.body.opa = LV_OPA_TRANSP;
|
||||
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(&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(&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(&btnm_ina, &btnm_rel);
|
||||
btnm_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 60);
|
||||
|
||||
theme.style.btnm.bg = &btnm_bg;
|
||||
theme.style.btnm.btn.rel = &btnm_rel;
|
||||
theme.style.btnm.btn.pr = &btnm_pr;
|
||||
theme.style.btnm.btn.tgl_rel = &btnm_trel;
|
||||
theme.style.btnm.btn.tgl_pr = &btnm_pr;
|
||||
theme.style.btnm.btn.ina = &btnm_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
theme.style.kb.bg = &btnm_bg;
|
||||
theme.style.kb.btn.rel = &btnm_rel;
|
||||
theme.style.kb.btn.pr = &btnm_pr;
|
||||
theme.style.kb.btn.tgl_rel = &btnm_trel;
|
||||
theme.style.kb.btn.tgl_pr = &btnm_pr;
|
||||
theme.style.kb.btn.ina = &btnm_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
static lv_style_t mbox_bg;
|
||||
lv_style_copy(&mbox_bg, &panel);
|
||||
mbox_bg.body.shadow.width = LV_DPI / 12;
|
||||
|
||||
theme.style.mbox.bg = &mbox_bg;
|
||||
theme.style.mbox.btn.bg = &lv_style_transp;
|
||||
theme.style.mbox.btn.rel = &btn_trel;
|
||||
theme.style.mbox.btn.pr = &btn_tpr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
theme.style.page.bg = &panel;
|
||||
theme.style.page.scrl = &lv_style_transp_fit;
|
||||
theme.style.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
theme.style.ta.area = &panel;
|
||||
theme.style.ta.oneline = &panel;
|
||||
theme.style.ta.cursor = NULL;
|
||||
theme.style.ta.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void spinbox_init(void)
|
||||
{
|
||||
#if LV_USE_SPINBOX
|
||||
theme.style.spinbox.bg = &panel;
|
||||
theme.style.spinbox.cursor = theme.style.ta.cursor;
|
||||
theme.style.spinbox.sb = theme.style.ta.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_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.opa = LV_OPA_TRANSP;
|
||||
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;
|
||||
|
||||
lv_style_copy(&list_pr, &list_rel);
|
||||
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_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.left = 0;
|
||||
list_bg.body.padding.right = 0;
|
||||
list_bg.body.padding.top = 0;
|
||||
list_bg.body.padding.bottom = 0;
|
||||
|
||||
theme.style.list.sb = &sb;
|
||||
theme.style.list.bg = &list_bg;
|
||||
theme.style.list.scrl = &lv_style_transp_tight;
|
||||
theme.style.list.btn.rel = &list_rel;
|
||||
theme.style.list.btn.pr = &list_pr;
|
||||
theme.style.list.btn.tgl_rel = &list_trel;
|
||||
theme.style.list.btn.tgl_pr = &list_tpr;
|
||||
theme.style.list.btn.ina = &list_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
lv_style_copy(&ddlist_bg, &panel);
|
||||
ddlist_bg.text.line_space = LV_DPI / 8;
|
||||
ddlist_bg.body.padding.left = LV_DPI / 6;
|
||||
ddlist_bg.body.padding.right = LV_DPI / 6;
|
||||
ddlist_bg.body.padding.top = LV_DPI / 6;
|
||||
ddlist_bg.body.padding.bottom = 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;
|
||||
|
||||
theme.style.ddlist.bg = &ddlist_bg;
|
||||
theme.style.ddlist.sel = &ddlist_sel;
|
||||
theme.style.ddlist.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_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_sel, &panel);
|
||||
roller_sel.body.opa = LV_OPA_TRANSP;
|
||||
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.style.roller.bg = &roller_bg;
|
||||
theme.style.roller.sel = &roller_sel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 0
|
||||
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.left = 0;
|
||||
tab_rel.body.padding.right = 0;
|
||||
tab_rel.body.padding.top = LV_DPI / 6;
|
||||
tab_rel.body.padding.bottom = 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(&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(&tab_trel, &def);
|
||||
tab_trel.body.opa = LV_OPA_TRANSP;
|
||||
tab_trel.body.padding.left = 0;
|
||||
tab_trel.body.padding.right = 0;
|
||||
tab_trel.body.padding.top = LV_DPI / 6;
|
||||
tab_trel.body.padding.bottom = 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.left = 0;
|
||||
tab_tpr.body.padding.right = 0;
|
||||
tab_tpr.body.padding.top = LV_DPI / 6;
|
||||
tab_tpr.body.padding.bottom = 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(&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*/
|
||||
|
||||
theme.style.tabview.bg = &bg;
|
||||
theme.style.tabview.indic = &tab_indic;
|
||||
theme.style.tabview.btn.bg = &lv_style_transp_tight;
|
||||
theme.style.tabview.btn.rel = &tab_rel;
|
||||
theme.style.tabview.btn.pr = &tab_pr;
|
||||
theme.style.tabview.btn.tgl_rel = &tab_trel;
|
||||
theme.style.tabview.btn.tgl_pr = &tab_tpr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
theme.style.tileview.bg = &lv_style_transp_tight;
|
||||
theme.style.tileview.scrl = &lv_style_transp_tight;
|
||||
theme.style.tileview.sb = theme.style.page.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABLE != 0
|
||||
static lv_style_t cell;
|
||||
lv_style_copy(&cell, &panel);
|
||||
cell.body.radius = 0;
|
||||
cell.body.border.width = 1;
|
||||
|
||||
theme.style.table.bg = &lv_style_transp_tight;
|
||||
theme.style.table.cell = &cell;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
static lv_style_t win_header;
|
||||
|
||||
lv_style_copy(&win_header, &panel);
|
||||
win_header.body.radius = 0;
|
||||
win_header.body.padding.left = LV_DPI / 12;
|
||||
win_header.body.padding.right = LV_DPI / 12;
|
||||
win_header.body.padding.top = LV_DPI / 20;
|
||||
win_header.body.padding.bottom = LV_DPI / 20;
|
||||
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.text.color = lv_color_hsv_to_rgb(_hue, 5, 100);
|
||||
|
||||
theme.style.win.bg = &bg;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &btn_rel;
|
||||
theme.style.win.btn.pr = &btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
style->body.border.width = 2;
|
||||
style->body.border.color = LV_COLOR_SILVER;
|
||||
style->body.border.opa = LV_OPA_70;
|
||||
style->body.shadow.width = LV_DPI / 20;
|
||||
style->body.shadow.color = lv_color_hsv_to_rgb(_hue, 20, 90);
|
||||
style->body.main_color = lv_color_hsv_to_rgb(_hue, 40, 80);
|
||||
style->body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 80);
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* 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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
||||
basic_init();
|
||||
btn_init();
|
||||
label_init();
|
||||
bar_init();
|
||||
img_init();
|
||||
line_init();
|
||||
led_init();
|
||||
slider_init();
|
||||
sw_init();
|
||||
lmeter_init();
|
||||
gauge_init();
|
||||
arc_init();
|
||||
preload_init();
|
||||
chart_init();
|
||||
calendar_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
spinbox_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
tileview_init();
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
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
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_nemo.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_NEMO_H
|
||||
#define LV_THEME_NEMO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_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*/
|
@ -1,851 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_night.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_NIGHT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t scr, bg, sb, panel;
|
||||
static lv_style_t prim, sec, hint;
|
||||
|
||||
/*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_pretty); /*Initialize the default style*/
|
||||
def.text.font = _font;
|
||||
|
||||
lv_style_copy(&bg, &lv_style_plain);
|
||||
bg.body.main_color = lv_color_hsv_to_rgb(_hue, 11, 30);
|
||||
bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 11, 30);
|
||||
bg.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
bg.text.font = _font;
|
||||
bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 60);
|
||||
sb.body.border.width = 0;
|
||||
sb.body.padding.inner = LV_DPI / 20;
|
||||
sb.body.padding.left = 0;
|
||||
sb.body.padding.right = 0;
|
||||
sb.body.padding.top = 0;
|
||||
sb.body.padding.bottom = 0;
|
||||
sb.body.radius = LV_DPI / 30;
|
||||
sb.body.opa = LV_OPA_COVER;
|
||||
|
||||
lv_style_copy(&panel, &bg);
|
||||
panel.body.main_color = lv_color_hsv_to_rgb(_hue, 11, 18);
|
||||
panel.body.grad_color = lv_color_hsv_to_rgb(_hue, 11, 18);
|
||||
panel.body.radius = LV_DPI / 20;
|
||||
panel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 25);
|
||||
panel.body.border.width = 1;
|
||||
panel.body.border.opa = LV_OPA_COVER;
|
||||
panel.body.padding.left = LV_DPI / 10;
|
||||
panel.body.padding.right = LV_DPI / 10;
|
||||
panel.body.padding.top = LV_DPI / 10;
|
||||
panel.body.padding.bottom = LV_DPI / 10;
|
||||
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40);
|
||||
panel.line.width = 1;
|
||||
|
||||
theme.style.scr = &scr;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &def;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
|
||||
theme.style.cont = &panel;
|
||||
#endif
|
||||
}
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
|
||||
|
||||
lv_style_copy(&btn_rel, &def);
|
||||
btn_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
btn_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_rel.body.border.color = lv_color_hex3(0x111);
|
||||
btn_rel.body.border.width = 1;
|
||||
btn_rel.body.border.opa = LV_OPA_70;
|
||||
btn_rel.body.padding.left = LV_DPI / 4;
|
||||
btn_rel.body.padding.right = LV_DPI / 4;
|
||||
btn_rel.body.padding.top = LV_DPI / 8;
|
||||
btn_rel.body.padding.bottom = LV_DPI / 8;
|
||||
btn_rel.body.shadow.color = lv_color_hex3(0x111);
|
||||
btn_rel.body.shadow.width = LV_DPI / 30;
|
||||
btn_rel.text.color = lv_color_hex3(0xeee);
|
||||
btn_rel.image.color = lv_color_hex3(0xeee);
|
||||
|
||||
lv_style_copy(&btn_pr, &btn_rel);
|
||||
btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 30);
|
||||
btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
|
||||
lv_style_copy(&btn_tgl_rel, &btn_rel);
|
||||
btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
btn_tgl_rel.body.shadow.width = LV_DPI / 40;
|
||||
btn_tgl_rel.text.color = lv_color_hex3(0xddd);
|
||||
btn_tgl_rel.image.color = lv_color_hex3(0xddd);
|
||||
|
||||
lv_style_copy(&btn_tgl_pr, &btn_rel);
|
||||
btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 30);
|
||||
btn_tgl_pr.body.shadow.width = LV_DPI / 30;
|
||||
btn_tgl_pr.text.color = lv_color_hex3(0xddd);
|
||||
btn_tgl_pr.image.color = lv_color_hex3(0xddd);
|
||||
|
||||
lv_style_copy(&btn_ina, &btn_rel);
|
||||
btn_ina.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_ina.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
btn_ina.body.shadow.width = 0;
|
||||
btn_ina.text.color = lv_color_hex3(0xaaa);
|
||||
btn_ina.image.color = lv_color_hex3(0xaaa);
|
||||
|
||||
theme.style.btn.rel = &btn_rel;
|
||||
theme.style.btn.pr = &btn_pr;
|
||||
theme.style.btn.tgl_rel = &btn_tgl_rel;
|
||||
theme.style.btn.tgl_pr = &btn_tgl_pr;
|
||||
theme.style.btn.ina = &btn_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
|
||||
lv_style_copy(&prim, &bg);
|
||||
prim.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
|
||||
|
||||
lv_style_copy(&sec, &bg);
|
||||
sec.text.color = lv_color_hsv_to_rgb(_hue, 15, 65);
|
||||
|
||||
lv_style_copy(&hint, &bg);
|
||||
hint.text.color = lv_color_hsv_to_rgb(_hue, 20, 55);
|
||||
|
||||
theme.style.label.prim = &prim;
|
||||
theme.style.label.sec = &sec;
|
||||
theme.style.label.hint = &hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
|
||||
theme.style.line.decor = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_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, 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.style.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_IMG != 0
|
||||
|
||||
theme.style.img.light = &def;
|
||||
theme.style.img.dark = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_BAR
|
||||
static lv_style_t bar_bg, bar_indic;
|
||||
lv_style_copy(&bar_bg, &panel);
|
||||
bar_bg.body.padding.left = LV_DPI / 16;
|
||||
bar_bg.body.padding.right = LV_DPI / 16;
|
||||
bar_bg.body.padding.top = LV_DPI / 16;
|
||||
bar_bg.body.padding.bottom = LV_DPI / 16;
|
||||
bar_bg.body.radius = LV_RADIUS_CIRCLE;
|
||||
// bar_bg.body.corner_mask = 1;
|
||||
|
||||
lv_style_copy(&bar_indic, &def);
|
||||
bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
bar_indic.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
bar_indic.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 15);
|
||||
bar_indic.body.border.width = 1;
|
||||
bar_indic.body.border.opa = LV_OPA_COVER;
|
||||
bar_indic.body.radius = LV_RADIUS_CIRCLE;
|
||||
bar_indic.body.padding.left = 0;
|
||||
bar_indic.body.padding.right = 0;
|
||||
bar_indic.body.padding.top = 0;
|
||||
bar_indic.body.padding.bottom = 0;
|
||||
|
||||
theme.style.bar.bg = &bar_bg;
|
||||
theme.style.bar.indic = &bar_indic;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_SLIDER != 0
|
||||
static lv_style_t slider_knob;
|
||||
lv_style_copy(&slider_knob, theme.style.btn.rel);
|
||||
slider_knob.body.radius = LV_RADIUS_CIRCLE;
|
||||
slider_knob.body.padding.left = LV_DPI/25;
|
||||
slider_knob.body.padding.right = LV_DPI/25;
|
||||
slider_knob.body.padding.top = LV_DPI/25;
|
||||
slider_knob.body.padding.bottom = LV_DPI/25;
|
||||
|
||||
theme.style.slider.bg = theme.style.bar.bg;
|
||||
theme.style.slider.indic = theme.style.bar.indic;
|
||||
theme.style.slider.knob = &slider_knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
|
||||
theme.style.sw.bg = theme.style.bar.bg;
|
||||
theme.style.sw.indic = theme.style.bar.indic;
|
||||
theme.style.sw.knob_off = theme.style.slider.knob;
|
||||
theme.style.sw.knob_on = theme.style.slider.knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_LMETER != 0
|
||||
static lv_style_t lmeter_bg;
|
||||
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, 95, 90);
|
||||
lmeter_bg.body.padding.left = LV_DPI / 10; /*Scale line length*/
|
||||
lmeter_bg.body.padding.inner = LV_DPI / 10; /*Text padding*/
|
||||
lmeter_bg.body.border.color = lv_color_hex3(0x333);
|
||||
lmeter_bg.line.color = lv_color_hex3(0x555);
|
||||
lmeter_bg.line.width = 1;
|
||||
lmeter_bg.text.color = lv_color_hex3(0xddd);
|
||||
|
||||
theme.style.lmeter = &lmeter_bg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_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, 10, 70);
|
||||
gauge_bg.body.grad_color = gauge_bg.body.main_color;
|
||||
gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75);
|
||||
gauge_bg.line.width = 1;
|
||||
gauge_bg.text.color = lv_color_hex3(0xddd);
|
||||
|
||||
theme.style.gauge = &gauge_bg;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void arc_init(void)
|
||||
{
|
||||
#if LV_USE_ARC != 0
|
||||
|
||||
static lv_style_t arc;
|
||||
lv_style_copy(&arc, &def);
|
||||
arc.line.width = 8;
|
||||
arc.line.color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
arc.line.rounded = 1;
|
||||
|
||||
/*For spinner*/
|
||||
arc.body.border.width = 7;
|
||||
arc.body.border.color = lv_color_hsv_to_rgb(_hue, 11, 48);
|
||||
arc.body.padding.left = 1;
|
||||
arc.body.padding.right = 1;
|
||||
arc.body.padding.top = 1;
|
||||
arc.body.padding.bottom = 1;
|
||||
|
||||
theme.style.arc = &arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void preload_init(void)
|
||||
{
|
||||
#if LV_USE_SPINNER != 0
|
||||
|
||||
theme.style.preload = theme.style.arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
theme.style.chart = &panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR
|
||||
static lv_style_t cal_bg;
|
||||
lv_style_copy(&cal_bg, &bg);
|
||||
cal_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
cal_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
cal_bg.body.border.color = lv_color_hex3(0x333);
|
||||
cal_bg.body.border.width = 1;
|
||||
cal_bg.body.radius = LV_DPI / 20;
|
||||
cal_bg.body.padding.left = LV_DPI / 10;
|
||||
cal_bg.body.padding.right = LV_DPI / 10;
|
||||
cal_bg.body.padding.top = LV_DPI / 10;
|
||||
cal_bg.body.padding.bottom = LV_DPI / 10;
|
||||
|
||||
static lv_style_t cal_header;
|
||||
lv_style_copy(&cal_header, &bg);
|
||||
cal_header.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
cal_header.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
cal_header.body.radius = 0;
|
||||
cal_header.body.border.width = 1;
|
||||
cal_header.body.border.color = lv_color_hex3(0x333);
|
||||
cal_header.body.padding.left = LV_DPI / 10;
|
||||
cal_header.body.padding.right = LV_DPI / 10;
|
||||
cal_header.body.padding.top = LV_DPI / 10;
|
||||
cal_header.body.padding.bottom = LV_DPI / 10;
|
||||
|
||||
static lv_style_t week_box;
|
||||
lv_style_copy(&week_box, &panel);
|
||||
week_box.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 45);
|
||||
week_box.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 45);
|
||||
week_box.body.radius = LV_DPI / 20;
|
||||
week_box.body.border.width = 1;
|
||||
week_box.body.padding.left = LV_DPI / 20;
|
||||
week_box.body.padding.right = LV_DPI / 20;
|
||||
week_box.body.padding.top = LV_DPI / 25;
|
||||
week_box.body.padding.bottom = LV_DPI / 25;
|
||||
|
||||
static lv_style_t today_box;
|
||||
lv_style_copy(&today_box, &week_box);
|
||||
today_box.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
today_box.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
today_box.body.radius = LV_DPI / 20;
|
||||
today_box.body.padding.left = LV_DPI / 14;
|
||||
today_box.body.padding.right = LV_DPI / 14;
|
||||
today_box.body.padding.top = LV_DPI / 14;
|
||||
today_box.body.padding.bottom = LV_DPI / 14;
|
||||
|
||||
static lv_style_t highlighted_days;
|
||||
lv_style_copy(&highlighted_days, &bg);
|
||||
highlighted_days.text.color = lv_color_hsv_to_rgb(_hue, 40, 80);
|
||||
|
||||
static lv_style_t ina_days;
|
||||
lv_style_copy(&ina_days, &bg);
|
||||
ina_days.text.color = lv_color_hsv_to_rgb(_hue, 0, 60);
|
||||
|
||||
theme.style.calendar.bg = &cal_bg;
|
||||
theme.style.calendar.header = &cal_header;
|
||||
theme.style.calendar.week_box = &week_box;
|
||||
theme.style.calendar.today_box = &today_box;
|
||||
theme.style.calendar.highlighted_days = &highlighted_days;
|
||||
theme.style.calendar.day_names = &cal_bg;
|
||||
theme.style.calendar.inactive_days = &ina_days;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
|
||||
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.radius = LV_DPI / 20;
|
||||
rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 95);
|
||||
rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 95);
|
||||
rel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 50);
|
||||
rel.body.border.width = 2;
|
||||
;
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 80);
|
||||
pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 80);
|
||||
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
pr.body.border.width = 1;
|
||||
;
|
||||
|
||||
lv_style_copy(&tgl_rel, &rel);
|
||||
tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 90);
|
||||
tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 90);
|
||||
tgl_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 50);
|
||||
|
||||
lv_style_copy(&tgl_pr, &tgl_rel);
|
||||
tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 30);
|
||||
tgl_pr.body.border.width = 1;
|
||||
;
|
||||
|
||||
lv_style_copy(&ina, &rel);
|
||||
ina.body.main_color = lv_color_hex3(0x777);
|
||||
ina.body.grad_color = lv_color_hex3(0x777);
|
||||
ina.body.border.width = 0;
|
||||
|
||||
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 = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
static lv_style_t btnm_bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&btnm_bg, theme.style.btn.rel);
|
||||
btnm_bg.body.padding.left = 2;
|
||||
btnm_bg.body.padding.right = 2;
|
||||
btnm_bg.body.padding.top = 2;
|
||||
btnm_bg.body.padding.bottom = 2;
|
||||
btnm_bg.body.padding.inner = 0;
|
||||
btnm_bg.body.border.width = 1;
|
||||
|
||||
lv_style_copy(&rel, theme.style.btn.rel);
|
||||
rel.body.border.part = LV_BORDER_PART_FULL | LV_BORDER_PART_INTERNAL;
|
||||
rel.body.border.width = 1;
|
||||
rel.body.radius = 2;
|
||||
|
||||
lv_style_copy(&pr, theme.style.btn.pr);
|
||||
pr.body.border.part = rel.body.border.part;
|
||||
pr.body.border.width = rel.body.border.width;
|
||||
pr.body.radius = rel.body.radius;
|
||||
|
||||
lv_style_copy(&tgl_rel, theme.style.btn.tgl_rel);
|
||||
tgl_rel.body.border.part = rel.body.border.part;
|
||||
tgl_rel.body.border.width = rel.body.border.width;
|
||||
tgl_rel.body.radius = rel.body.radius;
|
||||
|
||||
lv_style_copy(&tgl_pr, theme.style.btn.pr);
|
||||
tgl_pr.body.border.part = rel.body.border.part;
|
||||
tgl_pr.body.border.width = rel.body.border.width;
|
||||
tgl_pr.body.radius = rel.body.radius;
|
||||
|
||||
lv_style_copy(&ina, theme.style.btn.ina);
|
||||
ina.body.border.part = rel.body.border.part;
|
||||
ina.body.border.width = rel.body.border.width;
|
||||
ina.body.radius = rel.body.radius;
|
||||
|
||||
theme.style.btnm.bg = &btnm_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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
theme.style.kb.bg = &bg;
|
||||
theme.style.kb.btn.rel = theme.style.btn.rel;
|
||||
theme.style.kb.btn.pr = theme.style.btn.pr;
|
||||
theme.style.kb.btn.tgl_rel = theme.style.btn.tgl_rel;
|
||||
theme.style.kb.btn.tgl_pr = theme.style.btn.tgl_pr;
|
||||
theme.style.kb.btn.ina = theme.style.btn.ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
static lv_style_t mbox_bg;
|
||||
lv_style_copy(&mbox_bg, &bg);
|
||||
mbox_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 30);
|
||||
mbox_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 30);
|
||||
mbox_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 11, 20);
|
||||
mbox_bg.body.border.width = 1;
|
||||
mbox_bg.body.shadow.width = LV_DPI / 10;
|
||||
mbox_bg.body.shadow.color = lv_color_hex3(0x222);
|
||||
mbox_bg.body.radius = LV_DPI / 20;
|
||||
theme.style.mbox.bg = &mbox_bg;
|
||||
theme.style.mbox.btn.bg = &lv_style_transp;
|
||||
theme.style.mbox.btn.rel = theme.style.btn.rel;
|
||||
theme.style.mbox.btn.pr = theme.style.btn.pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
|
||||
static lv_style_t page_scrl;
|
||||
lv_style_copy(&page_scrl, &bg);
|
||||
page_scrl.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
page_scrl.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
page_scrl.body.border.color = lv_color_hex3(0x333);
|
||||
page_scrl.body.border.width = 1;
|
||||
page_scrl.body.radius = LV_DPI / 20;
|
||||
|
||||
theme.style.page.bg = &panel;
|
||||
theme.style.page.scrl = &page_scrl;
|
||||
theme.style.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
theme.style.ta.area = &panel;
|
||||
theme.style.ta.oneline = &panel;
|
||||
theme.style.ta.cursor = NULL;
|
||||
theme.style.ta.sb = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void spinbox_init(void)
|
||||
{
|
||||
#if LV_USE_SPINBOX
|
||||
theme.style.spinbox.bg = &panel;
|
||||
theme.style.spinbox.cursor = theme.style.ta.cursor;
|
||||
theme.style.spinbox.sb = theme.style.ta.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
static lv_style_t list_bg, list_btn_rel, list_btn_pr, list_btn_tgl_rel, list_btn_tgl_pr;
|
||||
|
||||
lv_style_copy(&list_bg, &panel);
|
||||
list_bg.body.padding.top = 0;
|
||||
list_bg.body.padding.bottom = 0;
|
||||
list_bg.body.padding.left = 0;
|
||||
list_bg.body.padding.right = 0;
|
||||
list_bg.body.padding.inner = 0;
|
||||
|
||||
lv_style_copy(&list_btn_rel, &bg);
|
||||
list_btn_rel.body.opa = LV_OPA_TRANSP;
|
||||
list_btn_rel.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||
list_btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5);
|
||||
list_btn_rel.body.border.width = 1;
|
||||
list_btn_rel.body.radius = LV_DPI / 10;
|
||||
list_btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 80);
|
||||
list_btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 5, 80);
|
||||
list_btn_rel.body.padding.top = LV_DPI / 6;
|
||||
list_btn_rel.body.padding.bottom = LV_DPI / 6;
|
||||
list_btn_rel.body.padding.left = LV_DPI / 8;
|
||||
list_btn_rel.body.padding.right = LV_DPI / 8;
|
||||
|
||||
lv_style_copy(&list_btn_pr, theme.style.btn.pr);
|
||||
list_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 5);
|
||||
list_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 5);
|
||||
list_btn_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5);
|
||||
list_btn_pr.body.border.width = 0;
|
||||
list_btn_pr.body.padding.top = LV_DPI / 6;
|
||||
list_btn_pr.body.padding.bottom = LV_DPI / 6;
|
||||
list_btn_pr.body.padding.left = LV_DPI / 8;
|
||||
list_btn_pr.body.padding.right = LV_DPI / 8;
|
||||
list_btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 5, 80);
|
||||
list_btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 5, 80);
|
||||
|
||||
lv_style_copy(&list_btn_tgl_rel, &list_btn_rel);
|
||||
list_btn_tgl_rel.body.opa = LV_OPA_COVER;
|
||||
list_btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
list_btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
list_btn_tgl_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 40);
|
||||
list_btn_tgl_rel.body.radius = list_bg.body.radius;
|
||||
|
||||
lv_style_copy(&list_btn_tgl_pr, &list_btn_tgl_rel);
|
||||
list_btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 60);
|
||||
list_btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 60);
|
||||
|
||||
theme.style.list.sb = &sb;
|
||||
theme.style.list.bg = &list_bg;
|
||||
theme.style.list.scrl = &lv_style_transp_tight;
|
||||
theme.style.list.btn.rel = &list_btn_rel;
|
||||
theme.style.list.btn.pr = &list_btn_pr;
|
||||
theme.style.list.btn.tgl_rel = &list_btn_tgl_rel;
|
||||
theme.style.list.btn.tgl_pr = &list_btn_tgl_pr;
|
||||
theme.style.list.btn.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
static lv_style_t ddlist_bg, ddlist_sel;
|
||||
lv_style_copy(&ddlist_bg, theme.style.btn.rel);
|
||||
ddlist_bg.text.line_space = LV_DPI / 8;
|
||||
ddlist_bg.body.padding.top = LV_DPI / 8;
|
||||
ddlist_bg.body.padding.bottom = LV_DPI / 8;
|
||||
ddlist_bg.body.padding.left = LV_DPI / 8;
|
||||
ddlist_bg.body.padding.right = LV_DPI / 8;
|
||||
ddlist_bg.body.radius = LV_DPI / 30;
|
||||
|
||||
lv_style_copy(&ddlist_sel, theme.style.btn.rel);
|
||||
ddlist_sel.body.main_color = lv_color_hsv_to_rgb(_hue, 20, 50);
|
||||
ddlist_sel.body.grad_color = lv_color_hsv_to_rgb(_hue, 20, 50);
|
||||
ddlist_sel.body.radius = 0;
|
||||
|
||||
theme.style.ddlist.bg = &ddlist_bg;
|
||||
theme.style.ddlist.sel = &ddlist_sel;
|
||||
theme.style.ddlist.sb = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_ROLLER != 0
|
||||
static lv_style_t roller_bg;
|
||||
|
||||
lv_style_copy(&roller_bg, theme.style.ddlist.bg);
|
||||
roller_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
roller_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40);
|
||||
roller_bg.text.color = lv_color_hsv_to_rgb(_hue, 5, 70);
|
||||
roller_bg.text.opa = LV_OPA_60;
|
||||
|
||||
theme.style.roller.bg = &roller_bg;
|
||||
theme.style.roller.sel = theme.style.ddlist.sel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 0
|
||||
theme.style.tabview.bg = &bg;
|
||||
theme.style.tabview.indic = &lv_style_transp;
|
||||
theme.style.tabview.btn.bg = &lv_style_transp;
|
||||
theme.style.tabview.btn.rel = theme.style.btn.rel;
|
||||
theme.style.tabview.btn.pr = theme.style.btn.pr;
|
||||
theme.style.tabview.btn.tgl_rel = theme.style.btn.tgl_rel;
|
||||
theme.style.tabview.btn.tgl_pr = theme.style.btn.tgl_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
theme.style.tileview.bg = &lv_style_transp_tight;
|
||||
theme.style.tileview.scrl = &lv_style_transp_tight;
|
||||
theme.style.tileview.sb = theme.style.page.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABLE != 0
|
||||
static lv_style_t cell;
|
||||
lv_style_copy(&cell, &panel);
|
||||
cell.body.radius = 0;
|
||||
cell.body.border.width = 1;
|
||||
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;
|
||||
|
||||
theme.style.table.bg = &lv_style_transp_tight;
|
||||
theme.style.table.cell = &cell;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
static lv_style_t win_bg;
|
||||
lv_style_copy(&win_bg, &bg);
|
||||
win_bg.body.border.color = lv_color_hex3(0x333);
|
||||
win_bg.body.border.width = 1;
|
||||
|
||||
static lv_style_t win_header;
|
||||
lv_style_copy(&win_header, &win_bg);
|
||||
win_header.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
win_header.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20);
|
||||
win_header.body.radius = 0;
|
||||
win_header.body.padding.left = 0;
|
||||
win_header.body.padding.right = 0;
|
||||
win_header.body.padding.top = 0;
|
||||
win_header.body.padding.bottom = 0;
|
||||
|
||||
static lv_style_t win_btn_pr;
|
||||
lv_style_copy(&win_btn_pr, &def);
|
||||
win_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 10);
|
||||
win_btn_pr.text.color = lv_color_hex3(0xaaa);
|
||||
win_btn_pr.image.color = lv_color_hex3(0xaaa);
|
||||
|
||||
theme.style.win.bg = &win_bg;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &win_header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &lv_style_transp;
|
||||
theme.style.win.btn.pr = &win_btn_pr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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_hsv_to_rgb(_hue, 80, 70);
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the night 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_night_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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; 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();
|
||||
arc_init();
|
||||
preload_init();
|
||||
chart_init();
|
||||
calendar_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
spinbox_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
tileview_init();
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_night(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_night.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_NIGHT_H
|
||||
#define LV_THEME_NIGHT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_THEME_NIGHT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the night 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_night_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_night(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_NIGHT_H*/
|
@ -1,473 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_templ.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_TEMPL
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
/*Static style definitions*/
|
||||
|
||||
/*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_pretty); /*Initialize the default style*/
|
||||
def.text.font = _font;
|
||||
|
||||
theme.style.scr = &def;
|
||||
theme.style.bg = &def;
|
||||
theme.style.panel = &def;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
|
||||
theme.style.cont = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
|
||||
theme.style.btn.rel = &def;
|
||||
theme.style.btn.pr = &def;
|
||||
theme.style.btn.tgl_rel = &def;
|
||||
theme.style.btn.tgl_pr = &def;
|
||||
theme.style.btn.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void imgbtn_init(void)
|
||||
{
|
||||
#if LV_USE_IMGBTN != 0
|
||||
theme.style.imgbtn.rel = &def;
|
||||
theme.style.imgbtn.pr = &def;
|
||||
theme.style.imgbtn.tgl_rel = &def;
|
||||
theme.style.imgbtn.tgl_pr = &def;
|
||||
theme.style.imgbtn.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
|
||||
theme.style.label.prim = &def;
|
||||
theme.style.label.sec = &def;
|
||||
theme.style.label.hint = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_IMG != 0
|
||||
|
||||
theme.style.img.light = &def;
|
||||
theme.style.img.dark = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
|
||||
theme.style.line.decor = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_LED != 0
|
||||
|
||||
theme.style.led = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_BAR
|
||||
|
||||
theme.style.bar.bg = &def;
|
||||
theme.style.bar.indic = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_SLIDER != 0
|
||||
|
||||
theme.style.slider.bg = &def;
|
||||
theme.style.slider.indic = &def;
|
||||
theme.style.slider.knob = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
|
||||
theme.style.sw.bg = &def;
|
||||
theme.style.sw.indic = &def;
|
||||
theme.style.sw.knob_off = &def;
|
||||
theme.style.sw.knob_on = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_LMETER != 0
|
||||
|
||||
theme.style.lmeter = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_GAUGE != 0
|
||||
|
||||
theme.style.gauge = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void arc_init(void)
|
||||
{
|
||||
#if LV_USE_ARC != 0
|
||||
|
||||
theme.style.arc = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void preload_init(void)
|
||||
{
|
||||
#if LV_USE_SPINNER != 0
|
||||
|
||||
theme.style.preload = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
|
||||
theme.style.chart = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR
|
||||
|
||||
theme.style.calendar.bg = theme.style.panel;
|
||||
theme.style.calendar.header = &def;
|
||||
theme.style.calendar.inactive_days = &def;
|
||||
theme.style.calendar.highlighted_days = &def;
|
||||
theme.style.calendar.week_box = &def;
|
||||
theme.style.calendar.today_box = &def;
|
||||
theme.style.calendar.header_pr = &def;
|
||||
theme.style.calendar.day_names = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
|
||||
theme.style.cb.bg = &def;
|
||||
theme.style.cb.box.rel = &def;
|
||||
theme.style.cb.box.pr = &def;
|
||||
theme.style.cb.box.tgl_rel = &def;
|
||||
theme.style.cb.box.tgl_pr = &def;
|
||||
theme.style.cb.box.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
|
||||
theme.style.btnm.bg = &def;
|
||||
theme.style.btnm.btn.rel = &def;
|
||||
theme.style.btnm.btn.pr = &def;
|
||||
theme.style.btnm.btn.tgl_rel = &def;
|
||||
theme.style.btnm.btn.tgl_pr = &def;
|
||||
theme.style.btnm.btn.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
|
||||
theme.style.kb.bg = &def;
|
||||
theme.style.kb.btn.rel = &def;
|
||||
theme.style.kb.btn.pr = &def;
|
||||
theme.style.kb.btn.tgl_rel = &def;
|
||||
theme.style.kb.btn.tgl_pr = &def;
|
||||
theme.style.kb.btn.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
|
||||
theme.style.mbox.bg = &def;
|
||||
theme.style.mbox.btn.bg = &def;
|
||||
theme.style.mbox.btn.rel = &def;
|
||||
theme.style.mbox.btn.pr = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
|
||||
theme.style.page.bg = &def;
|
||||
theme.style.page.scrl = &def;
|
||||
theme.style.page.sb = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
|
||||
theme.style.ta.area = &def;
|
||||
theme.style.ta.oneline = &def;
|
||||
theme.style.ta.cursor = NULL; /*Let library to calculate the cursor's style*/
|
||||
theme.style.ta.sb = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
|
||||
theme.style.list.sb = &def;
|
||||
theme.style.list.bg = &def;
|
||||
theme.style.list.scrl = &def;
|
||||
theme.style.list.btn.rel = &def;
|
||||
theme.style.list.btn.pr = &def;
|
||||
theme.style.list.btn.tgl_rel = &def;
|
||||
theme.style.list.btn.tgl_pr = &def;
|
||||
theme.style.list.btn.ina = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
|
||||
theme.style.ddlist.bg = &def;
|
||||
theme.style.ddlist.sel = &def;
|
||||
theme.style.ddlist.sb = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_ROLLER != 0
|
||||
|
||||
theme.style.roller.bg = &def;
|
||||
theme.style.roller.sel = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 0
|
||||
|
||||
theme.style.tabview.bg = &def;
|
||||
theme.style.tabview.indic = &def;
|
||||
theme.style.tabview.btn.bg = &def;
|
||||
theme.style.tabview.btn.rel = &def;
|
||||
theme.style.tabview.btn.pr = &def;
|
||||
theme.style.tabview.btn.tgl_rel = &def;
|
||||
theme.style.tabview.btn.tgl_pr = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABLE != 0
|
||||
theme.style.table.bg = &def;
|
||||
theme.style.table.cell = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
|
||||
theme.style.win.bg = &def;
|
||||
theme.style.win.sb = &def;
|
||||
theme.style.win.header = &def;
|
||||
theme.style.win.content = &def;
|
||||
theme.style.win.btn.rel = &def;
|
||||
theme.style.win.btn.pr = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
|
||||
#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*/
|
||||
if(style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
|
||||
#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*/
|
||||
if(style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the templ 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_templ_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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
||||
basic_init();
|
||||
cont_init();
|
||||
btn_init();
|
||||
imgbtn_init();
|
||||
label_init();
|
||||
img_init();
|
||||
line_init();
|
||||
led_init();
|
||||
bar_init();
|
||||
slider_init();
|
||||
sw_init();
|
||||
lmeter_init();
|
||||
gauge_init();
|
||||
arc_init();
|
||||
preload_init();
|
||||
chart_init();
|
||||
calendar_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_templ(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_templ.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_TEMPL_H
|
||||
#define LV_THEME_TEMPL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_THEME_TEMPL
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the templ 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_templ_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_templ(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_TEMPL_H*/
|
@ -1,902 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_zen.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_theme.h"
|
||||
|
||||
#if LV_USE_THEME_ZEN
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
/*Static style definitions*/
|
||||
static lv_style_t def;
|
||||
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)
|
||||
{
|
||||
static lv_style_t bg;
|
||||
static lv_style_t scr;
|
||||
static lv_style_t panel;
|
||||
|
||||
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
|
||||
def.body.border.opa = LV_OPA_COVER;
|
||||
def.text.font = _font;
|
||||
def.text.color = lv_color_hex3(0x444);
|
||||
def.image.color = lv_color_hex3(0x444);
|
||||
|
||||
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(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
lv_style_copy(&panel, &bg);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
panel.body.border.width = 2;
|
||||
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);
|
||||
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;
|
||||
panel.body.padding.inner = LV_DPI / 10;
|
||||
|
||||
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 / 15;
|
||||
|
||||
theme.style.scr = &scr;
|
||||
theme.style.bg = &bg;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
|
||||
theme.style.cont = theme.style.panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
static lv_style_t rel, pr, tgl_pr, ina;
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.opa = LV_OPA_TRANSP;
|
||||
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);
|
||||
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;
|
||||
rel.text.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
||||
rel.image.color = lv_color_hsv_to_rgb(_hue, 40, 90);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.body.shadow.width = 0;
|
||||
pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 60);
|
||||
|
||||
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);
|
||||
tgl_pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 50);
|
||||
|
||||
lv_style_copy(&ina, &tgl_pr);
|
||||
ina.body.border.color = lv_color_hex3(0xbbb);
|
||||
ina.text.color = lv_color_hex3(0xbbb);
|
||||
ina.image.color = lv_color_hex3(0xbbb);
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
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);
|
||||
|
||||
theme.style.label.prim = &prim;
|
||||
theme.style.label.sec = &sec;
|
||||
theme.style.label.hint = &hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if LV_USE_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, 55);
|
||||
img_light.image.intense = LV_OPA_80;
|
||||
|
||||
theme.style.img.light = &img_light;
|
||||
theme.style.img.dark = &img_dark;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if LV_USE_LINE != 0
|
||||
|
||||
theme.style.line.decor = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if LV_USE_LED != 0
|
||||
|
||||
static lv_style_t led;
|
||||
lv_style_copy(&led, &lv_style_pretty_color);
|
||||
led.body.shadow.width = LV_DPI / 10;
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
led.body.border.width = LV_DPI / 30;
|
||||
led.body.border.opa = LV_OPA_30;
|
||||
led.body.main_color = lv_color_hsv_to_rgb(_hue, 60, 100);
|
||||
led.body.grad_color = lv_color_hsv_to_rgb(_hue, 60, 40);
|
||||
led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60);
|
||||
led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 80, 100);
|
||||
|
||||
theme.style.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if LV_USE_BAR
|
||||
static lv_style_t bg, indic;
|
||||
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.opa = LV_OPA_TRANSP;
|
||||
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;
|
||||
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;
|
||||
|
||||
theme.style.bar.bg = &bg;
|
||||
theme.style.bar.indic = &indic;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if LV_USE_SLIDER != 0
|
||||
static lv_style_t knob;
|
||||
|
||||
lv_style_copy(&knob, &def);
|
||||
knob.body.main_color = theme.style.bar.indic->body.main_color;
|
||||
knob.body.grad_color = knob.body.main_color;
|
||||
knob.body.radius = LV_RADIUS_CIRCLE;
|
||||
knob.body.border.width = 0;
|
||||
|
||||
theme.style.slider.bg = theme.style.bar.bg;
|
||||
theme.style.slider.indic = theme.style.bar.indic;
|
||||
theme.style.slider.knob = &knob;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if LV_USE_SWITCH != 0
|
||||
static lv_style_t indic;
|
||||
|
||||
lv_style_copy(&indic, theme.style.slider.indic);
|
||||
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;
|
||||
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;
|
||||
indic.body.padding.left = 0;
|
||||
indic.body.padding.right = 0;
|
||||
indic.body.padding.top = 0;
|
||||
indic.body.padding.bottom = 0;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if LV_USE_LMETER != 0
|
||||
static lv_style_t lmeter;
|
||||
|
||||
lv_style_copy(&lmeter, &def);
|
||||
lmeter.line.color = lv_color_hex3(0xddd);
|
||||
lmeter.line.width = 2;
|
||||
lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
lmeter.body.grad_color = lmeter.body.main_color;
|
||||
lmeter.body.padding.left = LV_DPI / 8;
|
||||
lmeter.body.padding.right = LV_DPI / 8;
|
||||
|
||||
theme.style.lmeter = &lmeter;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_GAUGE != 0
|
||||
static lv_style_t gauge;
|
||||
|
||||
lv_style_copy(&gauge, &def);
|
||||
gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70);
|
||||
gauge.line.width = 1;
|
||||
gauge.body.main_color = lv_color_hex3(0x999);
|
||||
gauge.body.grad_color = gauge.body.main_color;
|
||||
gauge.body.padding.left = LV_DPI / 16;
|
||||
gauge.body.padding.right = LV_DPI / 16;
|
||||
gauge.body.border.color = lv_color_hex3(0x666); /*Needle middle color*/
|
||||
|
||||
theme.style.gauge = &gauge;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void arc_init(void)
|
||||
{
|
||||
#if LV_USE_ARC != 0
|
||||
|
||||
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);
|
||||
arc.line.rounded = 1;
|
||||
|
||||
/*For spinner*/
|
||||
arc.body.border.width = 0;
|
||||
|
||||
theme.style.arc = &arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void preload_init(void)
|
||||
{
|
||||
#if LV_USE_SPINNER != 0
|
||||
|
||||
theme.style.preload = theme.style.arc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
theme.style.chart = theme.style.panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR != 0
|
||||
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);
|
||||
today_box.body.opa = LV_OPA_TRANSP;
|
||||
today_box.body.border.color = theme.style.panel->body.border.color;
|
||||
today_box.body.padding.top = LV_DPI / 20;
|
||||
today_box.body.padding.bottom = LV_DPI / 20;
|
||||
today_box.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.radius = LV_DPI / 20;
|
||||
rel.body.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);
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNMATRIX
|
||||
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&bg, &lv_style_transp);
|
||||
bg.glass = 0;
|
||||
bg.body.padding.left = 0;
|
||||
bg.body.padding.right = 0;
|
||||
bg.body.padding.top = 0;
|
||||
bg.body.padding.bottom = 0;
|
||||
bg.body.padding.inner = LV_DPI / 15;
|
||||
bg.text.font = _font;
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.opa = LV_OPA_TRANSP;
|
||||
rel.body.border.width = 0;
|
||||
|
||||
lv_style_copy(&pr, &def);
|
||||
pr.body.opa = LV_OPA_TRANSP;
|
||||
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);
|
||||
tgl_rel.body.opa = LV_OPA_COVER;
|
||||
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);
|
||||
;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if LV_USE_KEYBOARD
|
||||
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.main_color = lv_color_hex3(0x666);
|
||||
bg.body.grad_color = bg.body.main_color;
|
||||
bg.body.padding.left = 0;
|
||||
bg.body.padding.right = 0;
|
||||
bg.body.padding.top = 0;
|
||||
bg.body.padding.bottom = 0;
|
||||
bg.body.padding.inner = 0;
|
||||
bg.body.radius = 0;
|
||||
bg.body.border.width = 0;
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.opa = LV_OPA_COVER;
|
||||
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);
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if LV_USE_MSGBOX
|
||||
static lv_style_t bg, rel, pr;
|
||||
lv_style_copy(&bg, theme.style.panel);
|
||||
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);
|
||||
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;
|
||||
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;
|
||||
|
||||
theme.style.mbox.bg = &bg;
|
||||
theme.style.mbox.btn.bg = &lv_style_transp;
|
||||
theme.style.mbox.btn.rel = &rel;
|
||||
theme.style.mbox.btn.pr = ≺
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
|
||||
theme.style.page.bg = theme.style.panel;
|
||||
theme.style.page.scrl = &lv_style_transp;
|
||||
theme.style.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREA
|
||||
static lv_style_t oneline;
|
||||
lv_style_copy(&oneline, theme.style.panel);
|
||||
oneline.body.radius = LV_RADIUS_CIRCLE;
|
||||
oneline.body.padding.top = LV_DPI / 10;
|
||||
oneline.body.padding.bottom = LV_DPI / 10;
|
||||
oneline.body.shadow.width = 0;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void spinbox_init(void)
|
||||
{
|
||||
#if LV_USE_SPINBOX
|
||||
theme.style.spinbox.bg = theme.style.panel;
|
||||
theme.style.spinbox.cursor = theme.style.ta.cursor;
|
||||
theme.style.spinbox.sb = theme.style.ta.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
|
||||
|
||||
lv_style_copy(&bg, theme.style.panel);
|
||||
bg.body.padding.left = 0;
|
||||
bg.body.padding.right = 0;
|
||||
bg.body.padding.top = 0;
|
||||
bg.body.padding.bottom = 0;
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.opa = LV_OPA_TRANSP;
|
||||
rel.body.border.width = 0;
|
||||
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;
|
||||
rel.text.color = lv_color_hex3(0x666);
|
||||
rel.image.color = lv_color_hex3(0x666);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.text.color = theme.style.btn.pr->text.color;
|
||||
pr.image.color = theme.style.btn.pr->image.color;
|
||||
|
||||
lv_style_copy(&tgl_rel, &rel);
|
||||
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 90);
|
||||
|
||||
lv_style_copy(&tgl_pr, &rel);
|
||||
tgl_pr.text.color = theme.style.btn.tgl_pr->text.color;
|
||||
tgl_pr.image.color = theme.style.btn.tgl_pr->image.color;
|
||||
|
||||
lv_style_copy(&ina, &rel);
|
||||
ina.text.color = theme.style.btn.ina->text.color;
|
||||
ina.image.color = theme.style.btn.ina->image.color;
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
static lv_style_t bg, sel;
|
||||
lv_style_copy(&bg, theme.style.panel);
|
||||
bg.text.line_space = LV_DPI / 8;
|
||||
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;
|
||||
bg.text.color = lv_color_hex3(0x666);
|
||||
|
||||
lv_style_copy(&sel, &def);
|
||||
sel.body.opa = LV_OPA_TRANSP;
|
||||
sel.body.border.width = 0;
|
||||
sel.text.color = lv_color_hsv_to_rgb(_hue, 50, 80);
|
||||
|
||||
theme.style.ddlist.bg = &bg;
|
||||
theme.style.ddlist.sel = &sel;
|
||||
theme.style.ddlist.sb = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if LV_USE_ROLLER != 0
|
||||
static lv_style_t bg, sel;
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.border.width = 0;
|
||||
bg.body.opa = LV_OPA_TRANSP;
|
||||
bg.text.line_space = LV_DPI / 6;
|
||||
bg.text.color = lv_color_hex3(0x999);
|
||||
|
||||
lv_style_copy(&sel, theme.style.panel);
|
||||
sel.body.radius = LV_RADIUS_CIRCLE;
|
||||
sel.body.opa = LV_OPA_TRANSP;
|
||||
|
||||
theme.style.roller.bg = &bg;
|
||||
theme.style.roller.sel = &sel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABVIEW != 0
|
||||
static lv_style_t btn_bg, indic, rel, pr, tgl_rel, tgl_pr;
|
||||
|
||||
lv_style_copy(&btn_bg, &def);
|
||||
btn_bg.body.opa = LV_OPA_TRANSP;
|
||||
btn_bg.body.border.width = 2;
|
||||
btn_bg.body.border.part = LV_BORDER_PART_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);
|
||||
rel.body.opa = LV_OPA_TRANSP;
|
||||
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);
|
||||
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
theme.style.tileview.bg = &lv_style_transp_tight;
|
||||
theme.style.tileview.scrl = &lv_style_transp_tight;
|
||||
theme.style.tileview.sb = theme.style.page.sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TEXTAREABLE != 0
|
||||
static lv_style_t cell;
|
||||
lv_style_copy(&cell, theme.style.panel);
|
||||
cell.body.radius = 0;
|
||||
cell.body.border.width = 1;
|
||||
cell.body.shadow.width = 0;
|
||||
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;
|
||||
|
||||
theme.style.table.bg = &lv_style_transp_tight;
|
||||
theme.style.table.cell = &cell;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
static lv_style_t header, rel, pr;
|
||||
|
||||
lv_style_copy(&header, &def);
|
||||
header.body.opa = LV_OPA_TRANSP;
|
||||
header.body.border.width = 2;
|
||||
header.body.border.part = LV_BORDER_PART_BOTTOM;
|
||||
header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
header.text.color = lv_color_hex3(0x666);
|
||||
header.image.color = lv_color_hex3(0x666);
|
||||
header.body.padding.top = 0;
|
||||
header.body.padding.bottom = 0;
|
||||
header.body.padding.inner = 0;
|
||||
|
||||
lv_style_copy(&rel, &def);
|
||||
rel.body.opa = LV_OPA_TRANSP;
|
||||
rel.body.border.width = 0;
|
||||
rel.text.color = lv_color_hex3(0x666);
|
||||
rel.image.color = lv_color_hex3(0x666);
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.text.color = lv_color_hex3(0x333);
|
||||
pr.image.color = lv_color_hex3(0x333);
|
||||
|
||||
theme.style.win.bg = theme.style.panel;
|
||||
theme.style.win.sb = &sb;
|
||||
theme.style.win.header = &header;
|
||||
theme.style.win.content = &lv_style_transp;
|
||||
theme.style.win.btn.rel = &rel;
|
||||
theme.style.win.btn.pr = ≺
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#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_hsv_to_rgb(_hue, 40, 50);
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
|
||||
#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*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* 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
|
||||
*/
|
||||
lv_theme_t * lv_theme_zen_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.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; 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();
|
||||
arc_init();
|
||||
preload_init();
|
||||
chart_init();
|
||||
calendar_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
spinbox_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
tileview_init();
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
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
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_zen.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_ZEN_H
|
||||
#define LV_THEME_ZEN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_THEME_ZEN
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
lv_theme_t * lv_theme_zen_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_zen(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_ZEN_H*/
|
Loading…
x
Reference in New Issue
Block a user