wieder darkmode versuchen

This commit is contained in:
2026-08-02 19:48:35 +02:00
parent 1005b4434c
commit aa7b5ee4f5
3 changed files with 14 additions and 18 deletions
+1 -1
View File
@@ -867,7 +867,7 @@
/* Documentation for themes can be found here: https://docs.lvgl.io/master/common-widget-features/styles/styles.html#themes . */
/** A simple, impressive and very complete theme */
#define LV_USE_THEME_DEFAULT 0
#define LV_USE_THEME_DEFAULT 1
#if LV_USE_THEME_DEFAULT
/** 0: Light mode; 1: Dark mode */
#define LV_THEME_DEFAULT_DARK 1
+8
View File
@@ -141,6 +141,14 @@ void display_init() {
LV_DISPLAY_RENDER_MODE_PARTIAL);
lv_display_set_flush_cb(lv_display_gfx, lv_display_flush_cb);
lv_theme_t *th = lv_theme_default_init(
lv_display_gfx,
lv_palette_main(LV_PALETTE_BLUE),
lv_palette_main(LV_PALETTE_CYAN),
true,
LV_FONT_DEFAULT);
lv_display_set_theme(lv_display_gfx, th);
lv_indev_t *indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(indev, lv_touch_read_cb);
+5 -17
View File
@@ -22,22 +22,12 @@ lv_color_t typeColor(const String &type) {
return Theme::textDim();
}
void styleRow(lv_obj_t *row) {
lv_obj_remove_style_all(row);
lv_obj_set_size(row, 280, LV_SIZE_CONTENT);
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, 0);
lv_obj_set_style_border_width(row, 0, 0);
lv_obj_set_style_pad_all(row, 6, 0);
lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE);
}
void buildList() {
if (!list) return;
lv_obj_clean(list);
if (!ok) {
lv_obj_t *lbl = lv_label_create(list);
lv_obj_remove_style_all(lbl);
lv_label_set_text(lbl, LV_SYMBOL_WARNING " Keine Verbindung");
lv_obj_set_style_text_color(lbl, Theme::accentError(), 0);
return;
@@ -45,20 +35,21 @@ void buildList() {
for (const auto &dep : lastData.departures) {
lv_obj_t *row = lv_obj_create(list);
styleRow(row);
lv_obj_set_size(row, 280, LV_SIZE_CONTENT);
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, 0);
lv_obj_set_style_border_width(row, 0, 0);
lv_obj_set_style_pad_all(row, 6, 0);
lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE);
String badge = String(dep.icon) + " " + dep.line;
lv_obj_t *ln = lv_label_create(row);
lv_obj_remove_style_all(ln);
lv_label_set_text(ln, badge.c_str());
lv_obj_set_style_text_color(ln, typeColor(dep.type), 0);
lv_obj_align(ln, LV_ALIGN_TOP_LEFT, 0, 0);
String dest = sanitizeGermanText(dep.destination.substring(0, 20));
lv_obj_t *d = lv_label_create(row);
lv_obj_remove_style_all(d);
lv_label_set_text(d, dest.c_str());
lv_obj_set_style_text_color(d, Theme::text(), 0);
lv_obj_align(d, LV_ALIGN_TOP_LEFT, 0, 18);
String right;
@@ -69,7 +60,6 @@ void buildList() {
if (dep.delayMin > 0) right += " +" + String(dep.delayMin);
}
lv_obj_t *t = lv_label_create(row);
lv_obj_remove_style_all(t);
lv_label_set_text(t, right.c_str());
lv_obj_set_style_text_color(t,
dep.cancelled ? Theme::accentError() : Theme::text(), 0);
@@ -90,13 +80,11 @@ void mvgScreen_setNavigator(ScreenId (*nav)(ScreenId)) { g_navigate = nav; }
void mvgScreen_create(Screen &s) {
list = lv_obj_create(s.root);
lv_obj_remove_style_all(list);
lv_obj_set_pos(list, 0, 0);
lv_obj_set_size(list, 320, 480 - 80);
lv_obj_set_style_bg_color(list, Theme::bg(), 0);
lv_obj_set_style_bg_opa(list, LV_OPA_COVER, 0);
lv_obj_set_style_border_width(list, 0, 0);
lv_obj_set_style_pad_all(list, 0, 0);
lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN);
lv_obj_add_flag(list, LV_OBJ_FLAG_SCROLLABLE);
back_button_create(s.root, on_back, nullptr);