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