theme: add default
This commit is contained in:
@@ -221,7 +221,10 @@ typedef struct {
|
||||
lv_style_t *bg;
|
||||
lv_style_t *sb;
|
||||
lv_style_t *header;
|
||||
lv_style_t *content;
|
||||
struct {
|
||||
lv_style_t *bg;
|
||||
lv_style_t *scrl;
|
||||
}content;
|
||||
struct {
|
||||
lv_style_t *rel;
|
||||
lv_style_t *pr;
|
||||
@@ -255,6 +258,7 @@ lv_theme_t * lv_theme_get_current(void);
|
||||
* POST INCLUDE
|
||||
*********************/
|
||||
#include "lv_theme_templ.h"
|
||||
#include "lv_theme_default.h"
|
||||
#include "lv_theme_alien.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -28,35 +28,40 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t bg;
|
||||
static lv_style_t panel; /*General fancy background (for e.g. chart or ta)*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t label_prim, label_sec, label_hint;
|
||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||
static lv_style_t img_light, img_dark;
|
||||
static lv_style_t line_decor;
|
||||
static lv_style_t led;
|
||||
static lv_style_t bar_bg, bar_indic;
|
||||
static lv_style_t slider_knob;
|
||||
static lv_style_t sw_bg, sw_indic, sw_knob;
|
||||
static lv_style_t lmeter_bg;
|
||||
static lv_style_t gauge_bg;
|
||||
static lv_style_t list_bg, list_rel, list_pr, list_trel, list_tpr, list_ina;
|
||||
static lv_style_t ddlist_bg, ddlist_sel;
|
||||
static lv_style_t roller_bg, roller_sel;
|
||||
static lv_style_t cb_bg, cb_rel, cb_pr, cb_trel, cb_tpr, cb_ina;
|
||||
static lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_trel, btnm_ina;
|
||||
static lv_style_t mbox_bg;
|
||||
static lv_style_t tab_rel, tab_pr, tab_trel, tab_tpr, tab_indic;
|
||||
static lv_style_t win_header;
|
||||
|
||||
static uint16_t _hue;
|
||||
static font_t * _font;
|
||||
static font_t * _font;
|
||||
static font_t * _font;
|
||||
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
static lv_style_t bg;
|
||||
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||
|
||||
#if USE_LV_BAR
|
||||
static lv_style_t bar_bg, bar_indic;
|
||||
#endif
|
||||
|
||||
#if USE_LV_SLIDER
|
||||
static lv_style_t slider_knob;
|
||||
#endif
|
||||
|
||||
#if USE_LV_LMETER
|
||||
static lv_style_t lmeter_bg;
|
||||
#endif
|
||||
|
||||
#if USE_LV_DDLIST
|
||||
static lv_style_t ddlist_bg, ddlist_sel;
|
||||
#endif
|
||||
|
||||
#if USE_LV_BTNM
|
||||
static lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_trel, btnm_ina;
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -101,8 +106,8 @@ static void basic_init(void)
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.main_color = COLOR_HEX3(0x333);
|
||||
bg.body.gradient_color = COLOR_HEX3(0x333);
|
||||
bg.body.border.width = 0;
|
||||
bg.body.border.opa = OPA_70;
|
||||
bg.body.border.width = 2 << LV_ANTIALIAS;
|
||||
bg.body.border.color = COLOR_HEX3(0x666);
|
||||
bg.body.shadow.color = COLOR_SILVER;
|
||||
|
||||
/*Panel*/
|
||||
@@ -197,6 +202,8 @@ static void btn_init(void)
|
||||
static void label_init(void)
|
||||
{
|
||||
#if USE_LV_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 = color_hsv_to_rgb(_hue, 80, 96);
|
||||
@@ -226,7 +233,7 @@ static void bar_init(void)
|
||||
bar_bg.body.border.color = COLOR_SILVER;
|
||||
bar_bg.body.border.opa = OPA_20;
|
||||
bar_bg.body.padding.hor = 0;
|
||||
bar_bg.body.padding.ver = LV_DPI / 6;
|
||||
bar_bg.body.padding.ver = LV_DPI / 10;
|
||||
bar_bg.body.padding.inner = 0;
|
||||
|
||||
lv_style_copy(&bar_indic, &def);
|
||||
@@ -248,6 +255,7 @@ static void bar_init(void)
|
||||
static void img_init(void)
|
||||
{
|
||||
#if USE_LV_IMG != 0
|
||||
static lv_style_t img_light, img_dark;
|
||||
lv_style_copy(&img_light, &def);
|
||||
img_light.image.color = color_hsv_to_rgb(_hue, 15, 85);
|
||||
img_light.image.intense = OPA_80;
|
||||
@@ -264,6 +272,7 @@ static void img_init(void)
|
||||
static void line_init(void)
|
||||
{
|
||||
#if USE_LV_LINE != 0
|
||||
static lv_style_t line_decor;
|
||||
lv_style_copy(&line_decor, &def);
|
||||
line_decor.line.color = color_hsv_to_rgb(_hue, 50, 50);
|
||||
line_decor.line.width = 1 << LV_ANTIALIAS;
|
||||
@@ -275,6 +284,7 @@ static void line_init(void)
|
||||
static void led_init(void)
|
||||
{
|
||||
#if USE_LV_LED != 0
|
||||
static lv_style_t led;
|
||||
lv_style_copy(&led, &lv_style_pretty_color);
|
||||
led.body.shadow.width = LV_DPI / 10;
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
@@ -310,6 +320,7 @@ static void slider_init(void)
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if USE_LV_SW != 0
|
||||
static lv_style_t sw_bg, sw_indic, sw_knob;
|
||||
lv_style_copy(&sw_bg, &bar_bg);
|
||||
sw_bg.body.opa = OPA_COVER;
|
||||
sw_bg.body.padding.ver = -2 << LV_ANTIALIAS;
|
||||
@@ -353,6 +364,7 @@ static void lmeter_init(void)
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if USE_LV_GAUGE != 0
|
||||
static lv_style_t gauge_bg;
|
||||
lv_style_copy(&gauge_bg, &def);
|
||||
gauge_bg.body.main_color = color_hsv_to_rgb(_hue, 10, 70);
|
||||
gauge_bg.body.gradient_color = color_hsv_to_rgb(_hue, 80, 80);
|
||||
@@ -378,8 +390,8 @@ static void chart_init(void)
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
|
||||
#if USE_LV_CB != 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 << LV_ANTIALIAS;
|
||||
@@ -482,6 +494,7 @@ static void kb_init(void)
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if USE_LV_MBOX
|
||||
static lv_style_t mbox_bg;
|
||||
lv_style_copy(&mbox_bg, &panel);
|
||||
mbox_bg.body.shadow.width = LV_DPI / 12;
|
||||
|
||||
@@ -513,6 +526,7 @@ static void ta_init(void)
|
||||
static void list_init(void)
|
||||
{
|
||||
#if USE_LV_LIST != 0
|
||||
static lv_style_t list_bg, list_rel, list_pr, list_trel, list_tpr, list_ina;
|
||||
lv_style_copy(&list_rel, &def);
|
||||
list_rel.body.empty = 1;
|
||||
list_rel.body.border.width = 1 << LV_ANTIALIAS;
|
||||
@@ -568,16 +582,17 @@ static void ddlist_init(void)
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if USE_LV_ROLLER != 0
|
||||
static lv_style_t roller_bg, roller_sel;
|
||||
lv_style_copy(&roller_bg, &ddlist_bg);
|
||||
roller_bg.text.line_space = LV_DPI / 6;
|
||||
roller_bg.body.radius = LV_DPI / 20;
|
||||
roller_bg.body.main_color = COLOR_HEX3(0x222);
|
||||
roller_bg.body.main_color = COLOR_HEX3(0x333);
|
||||
roller_bg.body.gradient_color = COLOR_HEX3(0x999);
|
||||
roller_bg.body.border.opa = OPA_30;
|
||||
roller_bg.text.opa = OPA_70;
|
||||
roller_bg.text.color = color_hsv_to_rgb(_hue, 20, 70);
|
||||
roller_bg.body.shadow.width = LV_DPI / 20;
|
||||
roller_bg.body.shadow.color = COLOR_HEX3(0x111);
|
||||
roller_bg.body.shadow.color = COLOR_HEX3(0x444);
|
||||
|
||||
lv_style_copy(&roller_sel, &panel);
|
||||
roller_sel.body.empty = 1;
|
||||
@@ -592,6 +607,7 @@ static void roller_init(void)
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if USE_LV_TABVIEW != 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 = COLOR_HEX3(0x666);
|
||||
tab_rel.body.gradient_color = COLOR_HEX3(0x666);
|
||||
@@ -650,6 +666,8 @@ static void tabview_init(void)
|
||||
static void win_init(void)
|
||||
{
|
||||
#if USE_LV_WIN != 0
|
||||
static lv_style_t win_header;
|
||||
|
||||
lv_style_copy(&win_header, &def);
|
||||
win_header.body.radius = 0;
|
||||
win_header.body.padding.hor = LV_DPI / 12;
|
||||
@@ -662,10 +680,11 @@ static void win_init(void)
|
||||
win_header.body.border.part = LV_BORDER_BOTTOM;
|
||||
win_header.text.color = color_hsv_to_rgb(_hue, 5, 100);
|
||||
|
||||
theme.win.bg = &panel;
|
||||
theme.win.bg = &bg;
|
||||
theme.win.sb = &sb;
|
||||
theme.win.header = &win_header;
|
||||
theme.win.content = &lv_style_transp;
|
||||
theme.win.content.bg = &lv_style_transp;
|
||||
theme.win.content.scrl = &lv_style_transp;
|
||||
theme.win.btn.rel = &btn_rel;
|
||||
theme.win.btn.pr = &btn_pr;
|
||||
#endif
|
||||
|
||||
424
lv_themes/lv_theme_default.c
Normal file
424
lv_themes/lv_theme_default.c
Normal file
@@ -0,0 +1,424 @@
|
||||
/**
|
||||
* @file lv_theme_default.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "lv_theme.h"
|
||||
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_LV_THEME_DEFAULT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t def;
|
||||
|
||||
/*Static style definitions*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t plain_bordered;
|
||||
static lv_style_t label_prim;
|
||||
static lv_style_t label_sec;
|
||||
static lv_style_t label_hint;
|
||||
static lv_style_t slider_bg;
|
||||
static lv_style_t sw_bg;
|
||||
static lv_style_t lmeter;
|
||||
|
||||
/*Saved input parameters*/
|
||||
static uint16_t _hue;
|
||||
static 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(&sb, &lv_style_pretty_color);
|
||||
sb.body.gradient_color = sb.body.main_color;
|
||||
sb.body.padding.hor = sb.body.padding.hor / 2; /*Make closer to the edges*/
|
||||
sb.body.padding.ver = sb.body.padding.ver / 2;
|
||||
|
||||
lv_style_copy(&plain_bordered, &lv_style_plain);
|
||||
plain_bordered.body.border.width = 2 << LV_ANTIALIAS;
|
||||
plain_bordered.body.border.color= COLOR_HEX3(0xbbb);
|
||||
|
||||
theme.bg = &lv_style_plain;
|
||||
theme.panel = &lv_style_pretty;
|
||||
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if USE_LV_BTN != 0
|
||||
theme.btn.rel = &lv_style_btn_released;
|
||||
theme.btn.pr = &lv_style_btn_pressed;
|
||||
theme.btn.tgl_rel = &lv_style_btn_tgl_released;
|
||||
theme.btn.tgl_pr = &lv_style_btn_tgl_pressed;
|
||||
theme.btn.ina = &lv_style_btn_inactive;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if USE_LV_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 = COLOR_HEX3(0x111);
|
||||
label_sec.text.color = COLOR_HEX3(0x888);
|
||||
label_hint.text.color = COLOR_HEX3(0xaaa);
|
||||
|
||||
|
||||
theme.label.prim = &label_prim;
|
||||
theme.label.sec = &label_sec;
|
||||
theme.label.hint = &label_hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if USE_LV_IMG != 0
|
||||
|
||||
|
||||
theme.img.light = &def;
|
||||
theme.img.dark = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_init(void)
|
||||
{
|
||||
#if USE_LV_LINE != 0
|
||||
|
||||
theme.line.decor = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void led_init(void)
|
||||
{
|
||||
#if USE_LV_LED != 0
|
||||
static lv_style_t led;
|
||||
|
||||
lv_style_copy(&led, &lv_style_pretty_color);
|
||||
led.body.shadow.width = LV_DPI / 10;
|
||||
led.body.radius = LV_RADIUS_CIRCLE;
|
||||
led.body.border.width= LV_DPI / 30;
|
||||
led.body.border.opa = OPA_30;
|
||||
led.body.shadow.color = led.body.main_color;
|
||||
|
||||
|
||||
theme.led = &led;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if USE_LV_BAR
|
||||
|
||||
theme.bar.bg = &lv_style_pretty;
|
||||
theme.bar.indic = &lv_style_pretty_color;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if USE_LV_SLIDER != 0
|
||||
lv_style_copy(&slider_bg, &lv_style_pretty);
|
||||
slider_bg.body.padding.hor = LV_DPI / 20;
|
||||
slider_bg.body.padding.ver = LV_DPI / 20;
|
||||
|
||||
theme.slider.bg = &slider_bg;
|
||||
theme.slider.indic = &lv_style_pretty_color;
|
||||
theme.slider.knob = &lv_style_pretty;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sw_init(void)
|
||||
{
|
||||
#if USE_LV_SW != 0
|
||||
lv_style_copy(&sw_bg, &lv_style_pretty);
|
||||
sw_bg.body.padding.hor = 3 << LV_ANTIALIAS;
|
||||
sw_bg.body.padding.ver = 3 << LV_ANTIALIAS;
|
||||
|
||||
theme.sw.bg = &sw_bg;
|
||||
theme.sw.indic = &lv_style_pretty_color;
|
||||
theme.sw.knob_off = &lv_style_pretty;
|
||||
theme.sw.knob_on = &lv_style_pretty;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void lmeter_init(void)
|
||||
{
|
||||
#if USE_LV_LMETER != 0
|
||||
|
||||
lv_style_copy(&lmeter, &lv_style_pretty_color);
|
||||
lmeter.line.color = COLOR_HEX3(0xddd);
|
||||
lmeter.line.width = 2 << LV_ANTIALIAS;
|
||||
lmeter.body.main_color = color_mix(lmeter.body.main_color , COLOR_WHITE, OPA_50);
|
||||
lmeter.body.gradient_color = color_mix(lmeter.body.gradient_color , COLOR_BLACK, OPA_50);
|
||||
|
||||
theme.lmeter = &lmeter;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if USE_LV_GAUGE != 0
|
||||
|
||||
|
||||
theme.gauge = &lmeter;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if USE_LV_CHART
|
||||
|
||||
|
||||
theme.chart = &lv_style_pretty;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cb_init(void)
|
||||
{
|
||||
#if USE_LV_CB != 0
|
||||
|
||||
|
||||
theme.cb.bg = &lv_style_transp;
|
||||
theme.cb.box.rel = &lv_style_pretty;
|
||||
theme.cb.box.pr = &lv_style_btn_pressed;
|
||||
theme.cb.box.tgl_rel = &lv_style_btn_tgl_released;
|
||||
theme.cb.box.tgl_pr = &lv_style_btn_tgl_pressed;
|
||||
theme.cb.box.ina = &lv_style_btn_inactive;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if USE_LV_BTNM
|
||||
|
||||
|
||||
theme.btnm.bg = &lv_style_pretty;
|
||||
theme.btnm.btn.rel = &lv_style_btn_released;
|
||||
theme.btnm.btn.pr = &lv_style_btn_pressed;
|
||||
theme.btnm.btn.tgl_rel = &lv_style_btn_tgl_released;
|
||||
theme.btnm.btn.tgl_pr = &lv_style_btn_tgl_pressed;
|
||||
theme.btnm.btn.ina = &lv_style_btn_inactive;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void kb_init(void)
|
||||
{
|
||||
#if USE_LV_KB
|
||||
|
||||
|
||||
theme.kb.bg = &lv_style_pretty;
|
||||
theme.kb.btn.rel = &lv_style_btn_released;
|
||||
theme.kb.btn.pr = &lv_style_btn_pressed;
|
||||
theme.kb.btn.tgl_rel = &lv_style_btn_tgl_released;
|
||||
theme.kb.btn.tgl_pr = &lv_style_btn_tgl_pressed;
|
||||
theme.kb.btn.ina = &lv_style_btn_inactive;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void mbox_init(void)
|
||||
{
|
||||
#if USE_LV_MBOX
|
||||
|
||||
|
||||
theme.mbox.bg = &lv_style_pretty;
|
||||
theme.mbox.btn.bg = &lv_style_transp;
|
||||
theme.mbox.btn.rel = &lv_style_btn_released;
|
||||
theme.mbox.btn.pr = &lv_style_btn_tgl_pressed;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void page_init(void)
|
||||
{
|
||||
#if USE_LV_PAGE
|
||||
|
||||
|
||||
theme.page.bg = &lv_style_pretty;
|
||||
theme.page.scrl = &lv_style_transp_tight;
|
||||
theme.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ta_init(void)
|
||||
{
|
||||
#if USE_LV_TA
|
||||
|
||||
|
||||
theme.ta.area = &lv_style_pretty;
|
||||
theme.ta.oneline = &lv_style_pretty;
|
||||
theme.ta.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if USE_LV_LIST != 0
|
||||
|
||||
|
||||
theme.list.bg = &lv_style_pretty;
|
||||
theme.list.scrl = &lv_style_transp;
|
||||
theme.list.sb = &sb;
|
||||
theme.list.btn.rel = &lv_style_btn_released;
|
||||
theme.list.btn.pr = &lv_style_btn_pressed;
|
||||
theme.list.btn.tgl_rel = &lv_style_btn_tgl_released;
|
||||
theme.list.btn.tgl_pr = &lv_style_btn_tgl_pressed;
|
||||
theme.list.btn.ina = &lv_style_btn_inactive;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if USE_LV_DDLIST != 0
|
||||
|
||||
|
||||
theme.ddlist.bg = &lv_style_pretty;
|
||||
theme.ddlist.sel = &lv_style_plain_color;
|
||||
theme.ddlist.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void roller_init(void)
|
||||
{
|
||||
#if USE_LV_ROLLER != 0
|
||||
|
||||
|
||||
theme.roller.bg = &lv_style_pretty;
|
||||
theme.roller.sel = &lv_style_plain_color;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if USE_LV_TABVIEW != 0
|
||||
|
||||
|
||||
theme.tabview.bg = &plain_bordered;
|
||||
theme.tabview.sb = &sb;
|
||||
theme.tabview.indic = &lv_style_plain_color;
|
||||
theme.tabview.btn.bg = &lv_style_transp;
|
||||
theme.tabview.btn.rel = &lv_style_btn_released;
|
||||
theme.tabview.btn.pr = &lv_style_btn_pressed;
|
||||
theme.tabview.btn.tgl_rel = &lv_style_btn_tgl_released;
|
||||
theme.tabview.btn.tgl_pr = &lv_style_btn_tgl_pressed;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if USE_LV_WIN != 0
|
||||
|
||||
|
||||
theme.win.bg = &plain_bordered;
|
||||
theme.win.sb = &sb;
|
||||
theme.win.header = &lv_style_plain_color;
|
||||
theme.win.content.bg = &lv_style_transp;
|
||||
theme.win.content.scrl = &lv_style_transp;
|
||||
theme.win.btn.rel = &lv_style_btn_released;
|
||||
theme.win.btn.pr = &lv_style_btn_pressed;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**********************
|
||||
* 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, font_t *font)
|
||||
{
|
||||
if(font == NULL) font = FONT_DEFAULT;
|
||||
|
||||
_hue = hue;
|
||||
_font = font;
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t **style_p = (lv_style_t**) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
||||
basic_init();
|
||||
btn_init();
|
||||
label_init();
|
||||
img_init();
|
||||
line_init();
|
||||
led_init();
|
||||
bar_init();
|
||||
slider_init();
|
||||
sw_init();
|
||||
lmeter_init();
|
||||
gauge_init();
|
||||
chart_init();
|
||||
cb_init();
|
||||
btnm_init();
|
||||
kb_init();
|
||||
mbox_init();
|
||||
page_init();
|
||||
ta_init();
|
||||
list_init();
|
||||
ddlist_init();
|
||||
roller_init();
|
||||
tabview_init();
|
||||
win_init();
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_templ(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
56
lv_themes/lv_theme_default.h
Normal file
56
lv_themes/lv_theme_default.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @file lv_theme_default.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_DEFAULT_H
|
||||
#define LV_THEME_DEFAULT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_LV_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, 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,5 +1,5 @@
|
||||
/**
|
||||
* @file lv_theme_alien.c
|
||||
* @file lv_theme_templ.c
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_LV_THEME_ALIEN
|
||||
#if USE_LV_THEME_TEMPL
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -78,17 +78,6 @@ static void label_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if USE_LV_BAR
|
||||
|
||||
|
||||
theme.bar.bg = &def;
|
||||
theme.bar.indic = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void img_init(void)
|
||||
{
|
||||
#if USE_LV_IMG != 0
|
||||
@@ -117,6 +106,16 @@ static void led_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bar_init(void)
|
||||
{
|
||||
#if USE_LV_BAR
|
||||
|
||||
|
||||
theme.bar.bg = &def;
|
||||
theme.bar.indic = &def;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void slider_init(void)
|
||||
{
|
||||
#if USE_LV_SLIDER != 0
|
||||
@@ -289,6 +288,7 @@ static void tabview_init(void)
|
||||
|
||||
|
||||
theme.tabview.bg = &def;
|
||||
theme.tabview.sb = &def;
|
||||
theme.tabview.indic = &def;
|
||||
theme.tabview.btn.bg = &def;
|
||||
theme.tabview.btn.rel = &def;
|
||||
@@ -307,7 +307,8 @@ static void win_init(void)
|
||||
theme.win.bg = &def;
|
||||
theme.win.sb = &def;
|
||||
theme.win.header = &def;
|
||||
theme.win.content = &def;
|
||||
theme.win.content.bg = &def;
|
||||
theme.win.content.scrl = &def;
|
||||
theme.win.btn.rel = &def;
|
||||
theme.win.btn.pr = &def;
|
||||
#endif
|
||||
@@ -320,7 +321,7 @@ static void win_init(void)
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the alien theme
|
||||
* 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
|
||||
@@ -343,10 +344,10 @@ lv_theme_t * lv_theme_templ_init(uint16_t hue, font_t *font)
|
||||
basic_init();
|
||||
btn_init();
|
||||
label_init();
|
||||
bar_init();
|
||||
img_init();
|
||||
line_init();
|
||||
led_init();
|
||||
bar_init();
|
||||
slider_init();
|
||||
sw_init();
|
||||
lmeter_init();
|
||||
@@ -371,7 +372,7 @@ lv_theme_t * lv_theme_templ_init(uint16_t hue, font_t *font)
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_templ(void)
|
||||
lv_theme_t * lv_theme_get_deafult(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file lv_theme_alien.h
|
||||
* @file lv_theme_templ.h
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the alien theme
|
||||
* 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
|
||||
|
||||
Reference in New Issue
Block a user