From 4f596a8f85dcfcf0307c925678bda41da99d194d Mon Sep 17 00:00:00 2001 From: Stefan Koelle Date: Sun, 2 Aug 2026 14:34:09 +0200 Subject: [PATCH] adjust mvg UI --- include/theme.h | 2 ++ src/ui/mvg_screen.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/theme.h b/include/theme.h index 066c4b1..a9c1baa 100644 --- a/include/theme.h +++ b/include/theme.h @@ -31,6 +31,8 @@ inline lv_color_t accentSun() { return lv_color_hex(0xFBC02D); } inline lv_color_t accentRain() { return lv_color_hex(0x4FC3F7); } inline lv_color_t accentUBahn() { return lv_color_hex(0x0079F6); } // MVG U-Bahn blue inline lv_color_t accentSBahn() { return lv_color_hex(0x0CB87E); } // MVG S-Bahn green +inline lv_color_t accentBus() { return lv_color_hex(0xF57C00); } // MVG Bus orange +inline lv_color_t accentTram() { return lv_color_hex(0xE040FB); } // MVG Tram magenta inline lv_color_t accentWarn() { return lv_color_hex(0xFFB300); } inline lv_color_t accentError() { return lv_color_hex(0xF44336); } inline lv_color_t accentStorm() { return lv_color_hex(0xFFD54F); } diff --git a/src/ui/mvg_screen.cpp b/src/ui/mvg_screen.cpp index c21dba6..cc50e1d 100644 --- a/src/ui/mvg_screen.cpp +++ b/src/ui/mvg_screen.cpp @@ -16,6 +16,14 @@ lv_obj_t *list = nullptr; unsigned long lastFetchMs = 0; const unsigned long REFRESH_INTERVAL_MS = 60UL * 1000UL; +lv_color_t typeColor(const String &type) { + if (type == "UBAHN") return Theme::accentUBahn(); + if (type == "SBAHN") return Theme::accentSBahn(); + if (type == "BUS") return Theme::accentBus(); + if (type == "TRAM") return Theme::accentTram(); + return Theme::textDim(); +} + void buildList() { if (!list) return; lv_obj_clean(list); @@ -34,13 +42,12 @@ void buildList() { 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); + lv_obj_set_style_text_color(row, Theme::text(), 0); - // Line badge (colored text: U red, S green). String badge = String(dep.icon) + " " + dep.line; lv_obj_t *ln = lv_label_create(row); lv_label_set_text(ln, badge.c_str()); - lv_obj_set_style_text_color(ln, - dep.type == "UBAHN" ? Theme::accentUBahn() : Theme::accentSBahn(), 0); + 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)); @@ -81,6 +88,7 @@ void mvgScreen_create(Screen &s) { lv_obj_set_size(list, 320, 480 - 80); lv_obj_set_style_bg_color(list, Theme::bg(), 0); lv_obj_set_style_border_width(list, 0, 0); + lv_obj_set_style_text_color(list, Theme::text(), 0); back_button_create(s.root, on_back, nullptr); }