Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_themes/lv_theme_hekate.c
3694 views
1
/*
2
* Copyright (c) 2018-2026 CTCaer
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms and conditions of the GNU General Public License,
6
* version 2, as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
* more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*/
16
17
/*********************
18
* INCLUDES
19
*********************/
20
#include "lv_theme.h"
21
22
#if USE_LV_THEME_HEKATE
23
24
/*********************
25
* DEFINES
26
*********************/
27
#define DEF_RADIUS 4
28
29
#define COLOR_HOS_TURQUOISE (_hue ? lv_color_hsv_to_rgb(_hue, 100, 100) : lv_color_hsv_to_rgb(53, 8, 90)) // 0x00FFC9
30
#define COLOR_HOS_TEAL_LIGHTER (_hue ? lv_color_hsv_to_rgb(_hue, 100, 93) : lv_color_hsv_to_rgb(53, 8, 81)) // 0x00EDBA
31
#define COLOR_HOS_TEAL_LIGHT (_hue ? lv_color_hsv_to_rgb(_hue, 100, 72) : lv_color_hsv_to_rgb(53, 8, 65)) // 0x00B78F
32
#define COLOR_HOS_TEAL (_hue ? lv_color_hsv_to_rgb(_hue, 100, 64) : lv_color_hsv_to_rgb(53, 8, 58)) // 0x00A273
33
#define COLOR_HOS_ORANGE LV_COLOR_HEX(0xFF5500)
34
#define COLOR_HOS_TXT_WHITE LV_COLOR_HEX(0xFBFBFB)
35
36
#define COLOR_BG_DARK LV_COLOR_HEX(theme_bg_color ? (theme_bg_color - 0x0B0B0B) : 0x121212) // 0x222222.
37
#define COLOR_BG LV_COLOR_HEX(theme_bg_color) // 0x2D2D2D.
38
#define COLOR_BG_LIGHT LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x101010) : 0x2D2D2D) // 0x3D3D3D.
39
#define COLOR_BG_LIGHTER LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x191919) : 0x363636) // 0x464646.
40
41
#define COLOR_INACTIVE LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x171717) : 0x343434) // 0x444444.
42
#define COLOR_BAR LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x202020) : 0x3D3D3D) // 0x4D4D4D.
43
#define COLOR_PRESS LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x232323) : 0x404040) // 0x505050.
44
#define COLOR_LINE LV_COLOR_HEX(theme_bg_color ? (theme_bg_color + 0x383838) : 0x555555) // 0x656565.
45
46
#define COLOR_SHADOW_LIGHT LV_COLOR_HEX(0xAAAAAA)
47
#define COLOR_SHADOW LV_COLOR_HEX(theme_bg_color ? theme_bg_color : 0x181818) // 0x2D2D2D.
48
#define COLOR_SHADOW_DARK LV_COLOR_HEX(theme_bg_color ? 0x1F1F1F : 0x0A0A0A)
49
50
/**********************
51
* TYPEDEFS
52
**********************/
53
54
/**********************
55
* STATIC PROTOTYPES
56
**********************/
57
58
/**********************
59
* STATIC VARIABLES
60
**********************/
61
static lv_theme_t theme;
62
static lv_style_t def;
63
64
/*Static style definitions*/
65
static lv_style_t sb;
66
67
/*Saved input parameters*/
68
static uint16_t _hue;
69
static lv_font_t * _font;
70
uint32_t theme_bg_color;
71
72
/**********************
73
* MACROS
74
**********************/
75
76
/**********************
77
* STATIC FUNCTIONS
78
**********************/
79
80
static void basic_init(void)
81
{
82
static lv_style_t bg, panel;
83
84
lv_style_copy(&def, &lv_style_plain); // Initialize the default style.
85
def.text.font = _font;
86
def.body.radius = DEF_RADIUS;
87
def.text.color = COLOR_HOS_TXT_WHITE;
88
//def.image.color = COLOR_HOS_TXT_WHITE; //Needed if symbol image.
89
//def.image.opa = LV_OPA_COVER;
90
91
lv_style_copy(&bg, &def);
92
bg.body.main_color = COLOR_BG;
93
bg.body.grad_color = bg.body.main_color;
94
bg.body.radius = 0;
95
bg.body.empty = 1;
96
97
lv_style_copy(&panel, &def);
98
panel.body.radius = DEF_RADIUS;
99
panel.body.main_color = COLOR_BG;
100
panel.body.grad_color = panel.body.main_color;
101
panel.body.border.width = 1;
102
panel.body.border.color = COLOR_BAR;
103
panel.body.border.opa = LV_OPA_COVER;
104
panel.body.shadow.color = COLOR_SHADOW_LIGHT;
105
panel.body.shadow.type = LV_SHADOW_BOTTOM;
106
panel.body.shadow.width = 4;
107
panel.body.padding.hor = LV_DPI / 8;
108
panel.body.padding.ver = LV_DPI / 8;
109
panel.body.padding.inner = LV_DPI / 12;
110
//panel.text.color = COLOR_HOS_TXT_WHITE;
111
112
lv_style_copy(&sb, &def);
113
sb.body.main_color = LV_COLOR_BLACK;
114
sb.body.grad_color = sb.body.grad_color;
115
sb.body.opa = LV_OPA_40;
116
sb.body.padding.hor = LV_DPI / 25;
117
118
theme.bg = &bg;
119
theme.panel = &panel;
120
}
121
122
static void cont_init(void)
123
{
124
#if USE_LV_CONT != 0
125
static lv_style_t cont;
126
lv_style_copy(&cont, theme.panel);
127
cont.body.shadow.width = 0;
128
cont.body.border.width = 0;
129
130
theme.cont = &cont;
131
#endif
132
}
133
134
static void btn_init(void)
135
{
136
#if USE_LV_BTN != 0
137
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
138
139
lv_style_copy(&rel, &def);
140
rel.body.main_color = COLOR_BG_LIGHT;
141
rel.body.grad_color = rel.body.main_color;
142
rel.body.radius = 6;
143
rel.body.padding.hor = LV_DPI / 3;
144
rel.body.padding.ver = LV_DPI / 6;
145
rel.body.padding.inner = LV_DPI / 10;
146
rel.body.shadow.color = COLOR_SHADOW_DARK;
147
rel.body.shadow.type = LV_SHADOW_BOTTOM;
148
rel.body.shadow.width = 6;
149
rel.body.border.width = 0;
150
rel.body.border.color = COLOR_BG_LIGHT;
151
rel.body.border.part = LV_BORDER_FULL;
152
//rel.text.color = COLOR_HOS_TXT_WHITE;
153
154
lv_style_copy(&pr, &rel);
155
pr.body.main_color = COLOR_PRESS;
156
pr.body.grad_color = pr.body.main_color;
157
pr.body.shadow.width = 0;
158
pr.body.border.color = COLOR_HOS_TEAL_LIGHTER;
159
pr.text.color = COLOR_HOS_TURQUOISE;
160
pr.body.border.width = 4;
161
162
lv_style_copy(&tgl_rel, &rel);
163
tgl_rel.body.border.color = COLOR_HOS_TEAL_LIGHTER;
164
tgl_rel.body.border.width = 4;
165
166
lv_style_copy(&tgl_pr, &tgl_rel);
167
tgl_pr.body.main_color = COLOR_PRESS;
168
tgl_pr.body.grad_color = tgl_pr.body.main_color;
169
tgl_pr.text.color = COLOR_HOS_TURQUOISE;
170
tgl_pr.body.shadow.width = 0;
171
172
lv_style_copy(&ina, &rel);
173
ina.body.main_color = COLOR_BG_DARK;
174
ina.body.grad_color = ina.body.main_color;
175
//ina.body.shadow.width = 0;
176
ina.text.color = LV_COLOR_HEX(0x888888);
177
ina.body.border.width = 4;
178
179
theme.btn.rel = &rel;
180
theme.btn.pr = &pr;
181
theme.btn.tgl_rel = &tgl_rel;
182
theme.btn.tgl_pr = &tgl_pr;
183
theme.btn.ina = &ina;
184
#endif
185
}
186
187
188
static void label_init(void)
189
{
190
#if USE_LV_LABEL != 0
191
static lv_style_t prim, sec, hint;
192
193
lv_style_copy(&prim, &def);
194
prim.text.font = _font;
195
prim.text.color = COLOR_HOS_TXT_WHITE;
196
197
lv_style_copy(&sec, &prim);
198
sec.text.color = COLOR_HOS_ORANGE;
199
200
lv_style_copy(&hint, &prim);
201
hint.text.color = LV_COLOR_HEX(0xCCCCCC);
202
203
theme.label.prim = &prim;
204
theme.label.sec = &sec;
205
theme.label.hint = &hint;
206
#endif
207
}
208
209
static void line_init(void)
210
{
211
#if USE_LV_LINE != 0
212
static lv_style_t line;
213
lv_style_copy(&line, &def);
214
line.line.color = COLOR_LINE;
215
theme.line.decor = &line;
216
#endif
217
}
218
219
static void led_init(void)
220
{
221
#if USE_LV_LED != 0
222
static lv_style_t led;
223
lv_style_copy(&led, &def);
224
led.body.shadow.width = LV_DPI / 10;
225
led.body.radius = LV_RADIUS_CIRCLE;
226
led.body.border.width = LV_DPI / 30;
227
led.body.border.opa = LV_OPA_30;
228
led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100);
229
led.body.grad_color = led.body.main_color;
230
led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60);
231
led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 100, 100);
232
233
theme.led = &led;
234
#endif
235
}
236
237
static void bar_init(void)
238
{
239
#if USE_LV_BAR
240
static lv_style_t bar_bg, bar_indic;
241
242
lv_style_copy(&bar_bg, &def);
243
bar_bg.body.main_color = COLOR_BAR;
244
bar_bg.body.grad_color = bar_bg.body.main_color;
245
bar_bg.body.radius = 3;
246
bar_bg.body.border.width = 0;
247
bar_bg.body.padding.hor = LV_DPI / 12;
248
bar_bg.body.padding.ver = LV_DPI / 12;
249
250
lv_style_copy(&bar_indic, &bar_bg);
251
bar_indic.body.main_color = COLOR_HOS_TURQUOISE;
252
bar_indic.body.grad_color = bar_indic.body.main_color;
253
bar_indic.body.padding.hor = 0;
254
bar_indic.body.padding.ver = 0;
255
256
theme.bar.bg = &bar_bg;
257
theme.bar.indic = &bar_indic;
258
#endif
259
}
260
261
static void slider_init(void)
262
{
263
#if USE_LV_SLIDER != 0
264
static lv_style_t knob;
265
static lv_style_t slide_bar;
266
267
lv_style_copy(&knob, &def);
268
knob.body.radius = LV_RADIUS_CIRCLE;
269
knob.body.border.width = 0;
270
knob.body.main_color = theme.bar.indic->body.main_color;
271
knob.body.grad_color = knob.body.main_color;
272
273
lv_style_copy(&slide_bar, theme.bar.indic);
274
slide_bar.body.main_color = COLOR_HOS_TEAL_LIGHT;
275
slide_bar.body.grad_color = slide_bar.body.main_color;
276
277
theme.slider.bg = theme.bar.bg;
278
theme.slider.indic = &slide_bar;
279
theme.slider.knob = &knob;
280
#endif
281
}
282
283
static void sw_init(void)
284
{
285
#if USE_LV_SW != 0
286
static lv_style_t sw_bg, sw_indic, sw_knob_off, sw_knob_on;
287
lv_style_copy(&sw_bg, theme.slider.bg);
288
sw_bg.body.radius = LV_RADIUS_CIRCLE;
289
290
lv_style_copy(&sw_indic, theme.slider.bg);
291
sw_indic.body.radius = LV_RADIUS_CIRCLE;
292
293
lv_style_copy(&sw_knob_on, theme.slider.knob);
294
295
lv_style_copy(&sw_knob_off, &sw_knob_on);
296
sw_knob_off.body.main_color = LV_COLOR_HEX(0xDADADA);
297
sw_knob_off.body.grad_color = sw_knob_off.body.main_color;
298
sw_knob_off.body.border.width = 1;
299
sw_knob_off.body.border.color = LV_COLOR_HEX(0x999999);
300
sw_knob_off.body.border.opa = LV_OPA_COVER;
301
302
theme.sw.bg = &sw_bg;
303
theme.sw.indic = &sw_indic;
304
theme.sw.knob_off = &sw_knob_off;
305
theme.sw.knob_on = &sw_knob_on;
306
#endif
307
}
308
309
310
static void lmeter_init(void)
311
{
312
#if USE_LV_LMETER != 0
313
static lv_style_t lmeter;
314
lv_style_copy(&lmeter, &def);
315
lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 90);
316
lmeter.body.grad_color = lmeter.body.main_color;
317
lmeter.body.padding.hor = LV_DPI / 10; // Scale line length.
318
lmeter.line.color = LV_COLOR_HEX(0x999999);
319
lmeter.line.width = 2;
320
321
theme.lmeter = &lmeter;
322
#endif
323
}
324
325
static void gauge_init(void)
326
{
327
#if USE_LV_GAUGE != 0
328
329
static lv_style_t gauge;
330
lv_style_copy(&gauge, &def);
331
gauge.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 60);
332
gauge.body.grad_color = gauge.body.main_color;
333
gauge.body.padding.hor = LV_DPI / 16; // Scale line length.
334
gauge.body.padding.inner = LV_DPI / 8;
335
gauge.body.border.color = LV_COLOR_HEX(0x999999);
336
gauge.text.color = LV_COLOR_HEX(0xDDDDDD);
337
gauge.line.width = 3;
338
gauge.line.color = lv_color_hsv_to_rgb(_hue, 95, 70);
339
340
theme.gauge = &gauge;
341
#endif
342
}
343
344
static void arc_init(void)
345
{
346
#if USE_LV_ARC != 0
347
348
static lv_style_t arc;
349
lv_style_copy(&arc, &def);
350
arc.line.width = 10;
351
arc.line.color = lv_color_hsv_to_rgb(_hue, 90, 90);
352
353
/*For prelaoder*/
354
arc.body.border.width = 10;
355
arc.body.border.color = lv_color_hsv_to_rgb(_hue, 30, 90);
356
arc.body.padding.hor = 0;
357
arc.body.padding.ver = 0;
358
359
theme.arc = &arc;
360
#endif
361
}
362
363
static void preload_init(void)
364
{
365
#if USE_LV_PRELOAD != 0
366
367
theme.preload = theme.arc;
368
#endif
369
}
370
371
static void chart_init(void)
372
{
373
#if USE_LV_CHART
374
theme.chart = theme.panel;
375
#endif
376
}
377
378
static void calendar_init(void)
379
{
380
#if USE_LV_CALENDAR
381
static lv_style_t ina_days;
382
lv_style_copy(&ina_days, &def);
383
ina_days.text.color = lv_color_hsv_to_rgb(_hue, 0, 70);
384
385
static lv_style_t high_days;
386
lv_style_copy(&high_days, &def);
387
high_days.text.color = lv_color_hsv_to_rgb(_hue, 80, 90);
388
389
static lv_style_t week_box;
390
lv_style_copy(&week_box, &def);
391
week_box.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 100);
392
week_box.body.grad_color = week_box.body.main_color;
393
week_box.body.padding.ver = LV_DPI / 20;
394
week_box.body.padding.hor = theme.panel->body.padding.hor;
395
week_box.body.border.color = theme.panel->body.border.color;
396
week_box.body.border.width = theme.panel->body.border.width;
397
week_box.body.border.part = LV_BORDER_LEFT | LV_BORDER_RIGHT;
398
week_box.body.radius = 0;
399
400
static lv_style_t today_box;
401
lv_style_copy(&today_box, &def);
402
today_box.body.main_color = LV_COLOR_WHITE;
403
today_box.body.grad_color = today_box.body.main_color;
404
today_box.body.padding.ver = LV_DPI / 20;
405
today_box.body.radius = 0;
406
407
theme.calendar.bg = theme.panel;
408
theme.calendar.header = &lv_style_transp;
409
theme.calendar.inactive_days = &ina_days;
410
theme.calendar.highlighted_days = &high_days;
411
theme.calendar.week_box = &week_box;
412
theme.calendar.today_box = &today_box;
413
#endif
414
}
415
416
static void cb_init(void)
417
{
418
#if USE_LV_CB != 0
419
static lv_style_t rel, pr, tgl_rel, tgl_pr, ina;
420
lv_style_copy(&rel, theme.panel);
421
rel.body.shadow.type = LV_SHADOW_FULL;
422
rel.body.shadow.width = 3;
423
424
lv_style_copy(&pr, &rel);
425
pr.body.main_color = LV_COLOR_HEX(0xCCCCCC);
426
pr.body.grad_color = pr.body.main_color;
427
pr.body.shadow.width = 3;
428
429
lv_style_copy(&tgl_rel, &rel);
430
tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 85);
431
tgl_rel.body.grad_color = tgl_rel.body.main_color;
432
tgl_rel.body.shadow.width = 0;
433
434
lv_style_copy(&tgl_pr, &tgl_rel);
435
tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 65);
436
tgl_pr.body.grad_color = tgl_pr.body.main_color;
437
438
lv_style_copy(&ina, theme.btn.ina);
439
440
theme.cb.bg = &lv_style_transp;
441
theme.cb.box.rel = &rel;
442
theme.cb.box.pr = &pr;
443
theme.cb.box.tgl_rel = &tgl_rel;
444
theme.cb.box.tgl_pr = &tgl_pr;
445
theme.cb.box.ina = &ina;
446
#endif
447
}
448
449
450
static void btnm_init(void)
451
{
452
#if USE_LV_BTNM
453
static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina;
454
455
lv_style_copy(&bg, theme.panel);
456
bg.body.padding.hor = 0;
457
bg.body.padding.ver = 0;
458
bg.body.padding.inner = 0;
459
bg.text.color = LV_COLOR_HEX(0x555555);
460
461
lv_style_copy(&rel, theme.panel);
462
rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL;
463
rel.body.border.width = 1;
464
rel.body.border.color = LV_COLOR_HEX(0xBBBBBB);
465
rel.body.empty = 1;
466
rel.body.shadow.width = 0;
467
468
lv_style_copy(&pr, &rel);
469
pr.glass = 0;
470
pr.body.main_color = LV_COLOR_HEX(0xDDDDDD);
471
pr.body.grad_color = pr.body.main_color;
472
pr.body.border.width = 0;
473
pr.body.empty = 0;
474
475
lv_style_copy(&tgl_rel, &pr);
476
tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 90, 70);
477
tgl_rel.body.grad_color = tgl_rel.body.main_color;
478
tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
479
480
lv_style_copy(&tgl_pr, &tgl_rel);
481
tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 95, 65);
482
tgl_pr.body.grad_color = tgl_pr.body.main_color;
483
tgl_pr.body.border.width = 0;
484
485
lv_style_copy(&ina, theme.btn.ina);
486
487
theme.btnm.bg = &bg;
488
theme.btnm.btn.rel = &rel;
489
theme.btnm.btn.pr = &pr;
490
theme.btnm.btn.tgl_rel = &tgl_rel;
491
theme.btnm.btn.tgl_pr = &tgl_pr;
492
theme.btnm.btn.ina = &ina;
493
#endif
494
}
495
496
static void kb_init(void)
497
{
498
#if USE_LV_KB
499
500
static lv_style_t bg, rel;
501
502
lv_style_copy(&bg, theme.btnm.bg);
503
bg.text.color = LV_COLOR_HEX(0xCCCCCC);
504
bg.body.border.width = 0;
505
bg.body.radius = 0;
506
bg.body.shadow.color = COLOR_SHADOW_DARK;
507
bg.body.shadow.type = LV_SHADOW_BOTTOM;
508
bg.body.shadow.width = 4;
509
510
lv_style_copy(&rel, &lv_style_transp);
511
rel.text.font = _font;
512
513
theme.kb.bg = &bg;
514
theme.kb.btn.rel = &rel;
515
theme.kb.btn.pr = theme.btnm.btn.pr;
516
theme.kb.btn.tgl_rel = theme.btnm.btn.tgl_rel;
517
theme.kb.btn.tgl_pr = theme.btnm.btn.tgl_pr;
518
theme.kb.btn.ina = theme.btnm.btn.ina;
519
#endif
520
521
}
522
523
static void mbox_init(void)
524
{
525
#if USE_LV_MBOX
526
static lv_style_t bg;
527
528
lv_style_copy(&bg, theme.panel);
529
bg.body.main_color = COLOR_BG_LIGHTER;
530
bg.body.grad_color = bg.body.main_color;
531
bg.body.shadow.color = COLOR_SHADOW;
532
bg.body.shadow.type = LV_SHADOW_FULL;
533
bg.body.shadow.width = 8;
534
535
bg.body.padding.hor = LV_DPI * 3 / 6;
536
bg.body.padding.ver = LV_DPI / 4;
537
bg.body.padding.inner = LV_DPI / 3;
538
539
theme.mbox.bg = &bg;
540
theme.mbox.btn.bg = &lv_style_transp;
541
theme.mbox.btn.rel = theme.btn.rel;
542
theme.mbox.btn.pr = theme.btn.pr;
543
#endif
544
}
545
546
static void page_init(void)
547
{
548
#if USE_LV_PAGE
549
theme.page.bg = theme.panel;
550
theme.page.scrl = &lv_style_transp;
551
theme.page.sb = &sb;
552
#endif
553
}
554
555
static void ta_init(void)
556
{
557
#if USE_LV_TA
558
static lv_style_t panel, oneline;
559
560
lv_style_copy(&panel, theme.panel);
561
panel.body.border.width = 0;
562
panel.body.shadow.color = COLOR_SHADOW_DARK;
563
panel.body.shadow.type = LV_SHADOW_FULL;
564
panel.body.shadow.width = 3;
565
566
lv_style_copy(&oneline, &def);
567
oneline.body.empty = 1;
568
oneline.body.radius = 0;
569
oneline.body.border.part = LV_BORDER_BOTTOM;
570
oneline.body.border.width = 3;
571
oneline.body.border.color = LV_COLOR_HEX(0x555555);
572
oneline.body.border.opa = LV_OPA_COVER;
573
oneline.text.color = LV_COLOR_HEX(0x888888);
574
575
theme.ta.area = &panel;
576
theme.ta.oneline = &oneline;
577
theme.ta.cursor = NULL; // Let library to calculate the cursor's style.
578
theme.ta.sb = &sb;
579
#endif
580
}
581
582
static void spinbox_init(void)
583
{
584
#if USE_LV_SPINBOX
585
theme.spinbox.bg= theme.panel;
586
theme.spinbox.cursor = theme.ta.cursor;
587
theme.spinbox.sb = theme.ta.sb;
588
#endif
589
}
590
591
static void list_init(void)
592
{
593
#if USE_LV_LIST != 0
594
595
static lv_style_t list_bg, rel, pr, tgl_rel, tgl_pr, ina;
596
597
lv_style_copy(&list_bg, theme.panel);
598
list_bg.body.padding.hor = 0;
599
list_bg.body.padding.ver = 0;
600
list_bg.body.padding.inner = 0;
601
list_bg.body.shadow.width = 0;
602
603
lv_style_copy(&rel, &lv_style_transp);
604
rel.body.padding.hor = LV_DPI / 8;
605
rel.body.padding.ver = LV_DPI / 6;
606
rel.body.radius = 0;
607
rel.body.border.color = COLOR_INACTIVE;
608
rel.body.border.width = 1;
609
rel.body.border.part = LV_BORDER_BOTTOM;
610
611
lv_style_copy(&pr, &rel);
612
pr.glass = 0;
613
pr.body.main_color = COLOR_PRESS;
614
pr.body.grad_color = pr.body.main_color;
615
//pr.body.border.width = 1;
616
pr.body.empty = 0;
617
//pr.body.radius = 0;
618
// pr.text.font = _font;
619
620
lv_style_copy(&tgl_rel, &pr);
621
tgl_rel.body.main_color = COLOR_BG_LIGHT;
622
tgl_rel.body.grad_color = tgl_rel.body.main_color;
623
//tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95);
624
tgl_rel.text.color = COLOR_HOS_TEAL_LIGHTER;
625
626
lv_style_copy(&tgl_pr, &tgl_rel);
627
tgl_pr.body.main_color = COLOR_PRESS;
628
tgl_pr.body.grad_color = tgl_pr.body.main_color;
629
tgl_pr.body.border.width = 0;
630
631
lv_style_copy(&ina, &pr);
632
ina.body.main_color = COLOR_BG_DARK;
633
ina.body.grad_color = ina.body.main_color;
634
635
theme.list.sb = &sb;
636
theme.list.bg = &list_bg;
637
theme.list.scrl = &lv_style_transp_tight;
638
theme.list.btn.rel = &rel;
639
theme.list.btn.pr = &pr;
640
theme.list.btn.tgl_rel = &tgl_rel;
641
theme.list.btn.tgl_pr = &tgl_pr;
642
theme.list.btn.ina = &ina;
643
#endif
644
}
645
646
static void ddlist_init(void)
647
{
648
#if USE_LV_DDLIST != 0
649
static lv_style_t bg, sel;
650
lv_style_copy(&bg, theme.panel);
651
bg.body.padding.hor = LV_DPI / 6;
652
//bg.body.padding.ver = LV_DPI / 6;
653
bg.body.radius = 0;
654
bg.body.shadow.width = 0;
655
bg.body.border.width = 0;
656
bg.text.line_space = LV_DPI / 8;
657
bg.text.color = COLOR_HOS_TURQUOISE;
658
659
lv_style_copy(&sel, &bg);
660
sel.body.main_color = COLOR_BG_LIGHT;
661
sel.body.grad_color = sel.body.main_color;
662
663
theme.ddlist.bg = &bg;
664
theme.ddlist.bgo = &bg;
665
theme.ddlist.pr = &sel;
666
theme.ddlist.sel = &sel;
667
theme.ddlist.sb = &sb;
668
#endif
669
}
670
671
static void roller_init(void)
672
{
673
#if USE_LV_ROLLER != 0
674
static lv_style_t roller_bg, roller_sel;
675
676
lv_style_copy(&roller_bg, &lv_style_transp);
677
roller_bg.body.padding.hor = LV_DPI / 6;
678
roller_bg.body.padding.ver = LV_DPI / 6;
679
roller_bg.text.line_space = LV_DPI / 8;
680
roller_bg.text.font = _font;
681
roller_bg.glass = 0;
682
roller_bg.text.color = COLOR_INACTIVE;
683
684
lv_style_copy(&roller_sel, &roller_bg);
685
roller_sel.text.color = COLOR_HOS_TURQUOISE;
686
687
theme.roller.bg = &roller_bg;
688
theme.roller.sel = &roller_sel;
689
#endif
690
}
691
692
static void tabview_init(void)
693
{
694
#if USE_LV_TABVIEW != 0
695
static lv_style_t indic, btn_bg, rel, pr, tgl_rel, tgl_pr;
696
697
lv_style_copy(&indic, &def);
698
indic.body.main_color = COLOR_HOS_TURQUOISE;
699
indic.body.grad_color = indic.body.main_color;
700
indic.body.radius = 0;
701
indic.body.border.width = 0;
702
indic.body.padding.inner = LV_DPI / 20;
703
indic.body.opa = LV_OPA_0;
704
705
lv_style_copy(&btn_bg, &def);
706
btn_bg.body.main_color = COLOR_BG;
707
btn_bg.body.grad_color = btn_bg.body.main_color;
708
btn_bg.body.radius = 0;
709
btn_bg.body.empty = 1;
710
btn_bg.body.border.width = 0;
711
btn_bg.body.border.color = LV_COLOR_HEX(0xDDDDDD);
712
btn_bg.body.border.part = LV_BORDER_BOTTOM;
713
btn_bg.body.border.opa = LV_OPA_COVER;
714
btn_bg.body.shadow.width = 0;
715
btn_bg.body.shadow.color = COLOR_SHADOW_LIGHT;
716
btn_bg.body.shadow.type = LV_SHADOW_BOTTOM;
717
btn_bg.body.padding.inner = 0;
718
btn_bg.body.padding.hor = 0;
719
btn_bg.body.padding.ver = 0;
720
btn_bg.text.color = COLOR_HOS_TXT_WHITE;
721
722
lv_style_copy(&rel, &lv_style_transp);
723
rel.body.padding.ver = LV_DPI * 4 / 23;
724
rel.text.font = _font;
725
726
lv_style_copy(&pr, &def);
727
pr.body.main_color = COLOR_BG_LIGHT;
728
pr.body.grad_color = pr.body.main_color;
729
pr.body.border.width = 0;
730
pr.body.empty = 0;
731
pr.body.radius = 0;
732
pr.body.border.color = LV_COLOR_HEX(0x888888);
733
pr.body.border.part = LV_BORDER_BOTTOM;
734
pr.body.border.opa = LV_OPA_COVER;
735
pr.text.color = COLOR_HOS_TURQUOISE;
736
737
lv_style_copy(&tgl_rel, &lv_style_transp);
738
tgl_rel.glass = 0;
739
tgl_rel.text.font = _font;
740
tgl_rel.text.color = COLOR_HOS_TURQUOISE;
741
742
lv_style_copy(&tgl_pr, &def);
743
tgl_pr.body.main_color = COLOR_BG_LIGHT;
744
tgl_pr.body.grad_color = tgl_pr.body.main_color;
745
tgl_pr.body.border.width = 0;
746
tgl_pr.body.empty = 0;
747
tgl_pr.body.radius = 0;
748
tgl_pr.text.color = COLOR_HOS_TURQUOISE;
749
750
theme.tabview.bg = theme.bg;
751
theme.tabview.indic = &indic;
752
theme.tabview.btn.bg = &btn_bg;
753
theme.tabview.btn.rel = &rel;
754
theme.tabview.btn.pr = &pr;
755
theme.tabview.btn.tgl_rel = &tgl_rel;
756
theme.tabview.btn.tgl_pr = &tgl_pr;
757
#endif
758
}
759
760
static void tileview_init(void)
761
{
762
#if USE_LV_TILEVIEW != 0
763
theme.tileview.bg = &lv_style_transp_tight;
764
theme.tileview.scrl = &lv_style_transp_tight;
765
theme.tileview.sb = theme.page.sb;
766
#endif
767
}
768
769
static void table_init(void)
770
{
771
#if USE_LV_TABLE != 0
772
static lv_style_t cell;
773
lv_style_copy(&cell, theme.panel);
774
cell.body.radius = 0;
775
cell.body.border.width = 1;
776
cell.body.padding.hor = LV_DPI / 12;
777
cell.body.padding.ver = LV_DPI / 12;
778
779
theme.table.bg = &lv_style_transp_tight;
780
theme.table.cell = &cell;
781
#endif
782
}
783
784
static void win_init(void)
785
{
786
#if USE_LV_WIN != 0
787
static lv_style_t header, rel, pr;
788
789
lv_style_copy(&header, &def);
790
header.body.main_color = COLOR_BG;
791
header.body.grad_color = header.body.main_color;
792
header.body.radius = 0;
793
header.body.border.width = 0;
794
header.body.border.color = LV_COLOR_HEX(0xDDDDDD);
795
header.body.border.part = LV_BORDER_BOTTOM;
796
header.body.border.opa = LV_OPA_COVER;
797
header.body.shadow.width = 0;
798
header.body.shadow.color = COLOR_SHADOW_LIGHT;
799
header.body.shadow.type = LV_SHADOW_BOTTOM;
800
header.body.padding.inner = 0;
801
header.body.padding.hor = 8;
802
header.body.padding.ver = 0;
803
//header.text.color = COLOR_HOS_TXT_WHITE;
804
805
lv_style_copy(&rel, theme.btn.rel);
806
rel.body.radius = 0;
807
rel.body.opa = LV_OPA_0;
808
rel.body.border.width = 0;
809
810
lv_style_copy(&pr, theme.btn.pr);
811
pr.body.radius = 0;
812
pr.body.border.width = 0;
813
814
theme.win.bg = theme.panel;
815
theme.win.sb = &sb;
816
theme.win.header = &header;
817
theme.win.content.bg = &lv_style_transp;
818
theme.win.content.scrl = &lv_style_transp;
819
theme.win.btn.rel = &rel;
820
theme.win.btn.pr = &pr;
821
#endif
822
}
823
824
/**********************
825
* GLOBAL FUNCTIONS
826
**********************/
827
828
829
830
/**
831
* Initialize the hekate theme
832
* @param hue [0..360] hue value from HSV color space to define the theme's base color
833
* @param font pointer to a font (NULL to use the default)
834
* @return pointer to the initialized theme
835
*/
836
lv_theme_t * lv_theme_hekate_init(uint32_t bg_color, uint16_t hue, lv_font_t * font)
837
{
838
if(font == NULL) font = LV_FONT_DEFAULT;
839
840
theme_bg_color = bg_color;
841
_hue = hue;
842
_font = font;
843
844
/*For backward compatibility initialize all theme elements with a default style */
845
uint16_t i;
846
lv_style_t ** style_p = (lv_style_t **) &theme;
847
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
848
*style_p = &def;
849
style_p++;
850
}
851
852
basic_init();
853
cont_init();
854
btn_init();
855
label_init();
856
line_init();
857
led_init();
858
bar_init();
859
slider_init();
860
sw_init();
861
lmeter_init();
862
gauge_init();
863
chart_init();
864
arc_init();
865
preload_init();
866
calendar_init();
867
cb_init();
868
btnm_init();
869
kb_init();
870
mbox_init();
871
page_init();
872
ta_init();
873
spinbox_init();
874
list_init();
875
ddlist_init();
876
roller_init();
877
tabview_init();
878
tileview_init();
879
table_init();
880
win_init();
881
882
return &theme;
883
}
884
885
/**
886
* Get a pointer to the theme
887
* @return pointer to the theme
888
*/
889
lv_theme_t * lv_theme_get_hekate(void)
890
{
891
return &theme;
892
}
893
894
/**********************
895
* STATIC FUNCTIONS
896
**********************/
897
898
#endif
899
900
901