Files
Dual-PID/JC_Display_Firmware/theme.h
raw-designs 453644816f Initiale Bereitstellung
Initiale Bereitstellung der aktuellen Version auf Gitea
2026-07-10 18:13:43 +02:00

70 lines
2.8 KiB
C

// =====================================================================================
// theme.h - Farbwelt & Style-Helfer, abgestimmt auf die Web-UI
// =====================================================================================
// Palette aus Skripte/style.css:
// Accent #d89904 (Gold) BG #000000 -> #1a1a1a Text #ffffff
// Danger #dc3545 Warn #FFCC00 Border #555555
// =====================================================================================
#pragma once
#include <lvgl.h>
#define COL_BG lv_color_hex(0x0a0a0a)
#define COL_BG2 lv_color_hex(0x1a1a1a)
#define COL_CARD lv_color_hex(0x1e1e1e)
#define COL_CARD2 lv_color_hex(0x141414)
#define COL_ACCENT lv_color_hex(0xd89904)
#define COL_ACCENT_D lv_color_hex(0xb37e03)
#define COL_TEXT lv_color_hex(0xffffff)
#define COL_TEXT_DIM lv_color_hex(0xb0b0b0)
#define COL_TEXT_MUT lv_color_hex(0x808080)
#define COL_DANGER lv_color_hex(0xdc3545)
#define COL_WARN lv_color_hex(0xffcc00)
#define COL_OK lv_color_hex(0x66bb6a)
#define COL_BORDER lv_color_hex(0x555555)
#define COL_INPUT_BG lv_color_hex(0x101010)
// ---- Karte (dunkel, abgerundet) ----
static inline lv_obj_t* th_card(lv_obj_t* parent) {
lv_obj_t* c = lv_obj_create(parent);
lv_obj_set_style_bg_color(c, COL_CARD, 0);
lv_obj_set_style_bg_opa(c, LV_OPA_COVER, 0);
lv_obj_set_style_border_width(c, 1, 0);
lv_obj_set_style_border_color(c, lv_color_hex(0x2a2a2a), 0);
lv_obj_set_style_radius(c, 12, 0);
lv_obj_set_style_pad_all(c, 10, 0);
lv_obj_set_style_text_color(c, COL_TEXT, 0);
return c;
}
// ---- Akzent-Button (Gold, Pille) ----
static inline lv_obj_t* th_button(lv_obj_t* parent, const char* txt, lv_color_t bg, lv_color_t fg) {
lv_obj_t* b = lv_button_create(parent);
lv_obj_set_style_bg_color(b, bg, 0);
lv_obj_set_style_radius(b, 18, 0);
lv_obj_set_style_shadow_width(b, 0, 0);
lv_obj_t* l = lv_label_create(b);
lv_label_set_text(l, txt);
lv_obj_set_style_text_color(l, fg, 0);
lv_obj_center(l);
return b;
}
static inline lv_obj_t* th_accent_button(lv_obj_t* parent, const char* txt) {
return th_button(parent, txt, COL_ACCENT, lv_color_hex(0x000000));
}
// ---- Eingabefeld (Textarea) im Web-Look ----
static inline lv_obj_t* th_textarea(lv_obj_t* parent, bool oneLine) {
lv_obj_t* ta = lv_textarea_create(parent);
lv_textarea_set_one_line(ta, oneLine);
lv_obj_set_style_bg_color(ta, COL_INPUT_BG, 0);
lv_obj_set_style_border_color(ta, COL_BORDER, 0);
lv_obj_set_style_border_color(ta, COL_ACCENT, LV_PART_MAIN | LV_STATE_FOCUSED);
lv_obj_set_style_border_width(ta, 1, 0);
lv_obj_set_style_radius(ta, 8, 0);
lv_obj_set_style_text_color(ta, COL_TEXT, 0);
return ta;
}