From 94dc5ecbc4c9abfeae121bff7656d35a5bc87aa0 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 27 Oct 2026 22:28:28 +0100 Subject: [PATCH] Separate Matchday balance colours from the skin accent (by Codex) --- assets/modern/theme.rcss | 11 +++++++---- assets/modern/widgets.rcss | 2 +- docs/new_ui/desktop/widgets/README.md | 12 ++++++++++++ src/modern/ui/engine_screens.inc | 4 ++-- src/modern/ui/screens.inc | 4 ++-- src/modern/ui/view.cpp | 1 + src/modern/ui/widgets_screens.inc | 2 +- tests/modern_control_layout_tests.cpp | 16 ++++++++++++++++ 8 files changed, 42 insertions(+), 10 deletions(-) diff --git a/assets/modern/theme.rcss b/assets/modern/theme.rcss index 8672671..a4be86a 100644 --- a/assets/modern/theme.rcss +++ b/assets/modern/theme.rcss @@ -3,20 +3,20 @@ div,h1,h2,h3,p,label,header,section,aside,footer,nav {display:block;} span,small,strong {display:inline-block;} body { - --text:#e9f0f6;--muted:#afbfcd;--accent:#a5e2cf;--desk-top:#3c5264a8;--desk-bottom:#172b3ee0; + --text:#e9f0f6;--muted:#afbfcd;--accent:#a5e2cf;--money:#a5e2cf;--desk-top:#3c5264a8;--desk-bottom:#172b3ee0; --strong:#152a3af5;--soft:#d4eaff0b;--border:#e0f0ff2b; --menu-top:#303c49eb;--menu-bottom:#1a2531f2;--panel:#12243155;--input:#172633b0; --hover:#bad5f21a;--selected:#477f7c77;--danger:#f0aaa7;--on-accent:#152a3a; margin:0;width:100%;height:100%;overflow:hidden;font-family:Modern;font-size:32dp;color:var(--text);background-color:#0b121c; } body.silver { - --text:#233443;--muted:#526779;--accent:#25617a;--desk-top:#f4f9f3e6;--desk-bottom:#d6e1e9e8; + --text:#233443;--muted:#526779;--accent:#25617a;--money:#25617a;--desk-top:#f4f9f3e6;--desk-bottom:#d6e1e9e8; --strong:#e7f0f5fc;--soft:#315b7110;--border:#6c879c4a; --menu-top:#f0f5f9f5;--menu-bottom:#d4e0eaf5;--panel:#f1f6fa80;--input:#ffffffad; --hover:#9eb9d43b;--selected:#a3c3dd54;--danger:#a23f45;--on-accent:#f7fcff; } body.matchday { - --text:#efeded;--muted:#b7b4b9;--accent:#efb2aa;--desk-top:#303238f5;--desk-bottom:#1d2025f2; + --text:#efeded;--muted:#b7b4b9;--accent:#efb2aa;--money:#efeded;--desk-top:#303238f5;--desk-bottom:#1d2025f2; --strong:#272a30fc;--soft:#f9f4ed0b;--border:#ead9da29; --menu-top:#343338f5;--menu-bottom:#202126f7;--panel:#1d1e2466;--input:#191a208a; --hover:#d5b3b423;--selected:#d48c7b26;--danger:#f0a6a7;--on-accent:#2a2022; @@ -61,6 +61,9 @@ h3 {font-size:31dp;font-weight:bold;} .small {font-size:26dp;color:var(--muted);} .muted {color:var(--muted);} .accent {color:var(--accent);} +/* Monetary meaning stays independent of the skin highlight colour. */ +.money-amount {color:var(--money);} +.money-amount.is-negative {color:var(--danger);} .row {display:flex;align-items:center;gap:24dp;} .column {display:flex;flex-direction:column;gap:24dp;} .center {text-align:center;} @@ -117,7 +120,7 @@ h3 {font-size:31dp;font-weight:bold;} .info-date small {display:block;font-size:27dp;color:var(--muted);margin-top:8dp;} .info-cash {min-width:450dp;padding-left:58dp;border-left:2dp var(--border);} .info-cash small {display:block;font-size:27dp;color:var(--muted);} -.info-cash strong {font-size:40dp;color:var(--accent);} +.info-cash strong {font-size:40dp;color:var(--money);} .desktop-card {position:absolute;border:2dp var(--border);border-radius:36dp;decorator:linear-gradient(145deg,var(--desk-top),var(--desk-bottom));backdrop-filter:blur(34dp);overflow:hidden;} .desktop-card.pinned {border-color:var(--border);} .card-heading {position:absolute;left:30dp;right:30dp;top:22dp;color:var(--muted);font-size:25dp;} diff --git a/assets/modern/widgets.rcss b/assets/modern/widgets.rcss index c3c4ae9..9e2b459 100644 --- a/assets/modern/widgets.rcss +++ b/assets/modern/widgets.rcss @@ -21,7 +21,7 @@ body.silver .desk-calendar-month {background-color:#b76264;}body.matchday .desk- [data-widget=calendar][data-size=s] .desk-calendar-foot {height:60dp;font-size:20dp;gap:10dp;padding:8dp 18dp;} .desk-account-main {padding:16dp 34dp 20dp;display:flex;flex-direction:column;gap:10dp;} .desk-account-main>span {display:block;font-size:25dp;color:var(--muted);} -.desk-account-main>strong {display:block;font-size:65dp;letter-spacing:-2dp;font-weight:normal;line-height:1.1;color:var(--accent);} +.desk-account-main>strong {display:block;font-size:65dp;letter-spacing:-2dp;font-weight:normal;line-height:1.1;color:var(--money);} .desk-account-bottom {position:absolute;bottom:0;left:0;right:0;height:132dp;display:flex;align-items:center;justify-content:space-between;gap:30dp;padding:20dp 34dp;border-top:2dp var(--border);background-color:var(--soft);} .desk-account-bottom>div {display:flex;flex-direction:column;gap:8dp;} .desk-account-bottom span {display:block;font-size:24dp;color:var(--muted);} diff --git a/docs/new_ui/desktop/widgets/README.md b/docs/new_ui/desktop/widgets/README.md index 862f2b6..a05a37c 100644 --- a/docs/new_ui/desktop/widgets/README.md +++ b/docs/new_ui/desktop/widgets/README.md @@ -60,3 +60,15 @@ bleibt vollständig mit seitlichen Rändern innerhalb des quadratischen Widgets sichtbar. Damit werden Kopf und Schultern nicht stärker als in der HTML-Referenz angeschnitten. Bildquelle, ausgewählte Person und Widgetanordnung bleiben gleich; keine neue Assetgenerierung oder Datenänderung ist damit verbunden. + + +## Geldfarben + +Guthaben in Statusleiste und Kontowidget verwenden die semantische Geldfarbe +`--money` statt der allgemeinen Theme-Akzentfarbe. Matchday zeigt positive +Beträge und Nullwerte neutral hell; negative Kontostände tragen zusätzlich +`is-negative` und verwenden die Warnfarbe. Midnight und Silver behalten ihre +bisherigen positiven Geldfarben. Das gilt für Demo- und Engine-Einstieg; +Beträge und Spielregeln werden dadurch nicht verändert. Die synthetische +RmlUI-Kontrollprüfung deckt positive, null und negative Werte in allen drei +Themes bei vier Pixeldichten ab. diff --git a/src/modern/ui/engine_screens.inc b/src/modern/ui/engine_screens.inc index fbf74f5..5cd7762 100644 --- a/src/modern/ui/engine_screens.inc +++ b/src/modern/ui/engine_screens.inc @@ -48,7 +48,7 @@ void App::engine_render() { out = "
" + crest(club, 82) + "" + esc(engine_text(team.at("name"))) + "" + esc(engine_text(person.at("name"))) + "
" + esc(meta.at("date").get()) + "" + - esc(meta.at("season").at("label").get()) + "
Guthaben" + + esc(meta.at("season").at("label").get()) + "
Guthaben" + esc(engine_price(desk.at("accounts").at("cash"))) + "
"; init_desktop(); for (const auto &[id, o] : desktop_.at("objects").items()) { @@ -71,7 +71,7 @@ void App::engine_render() { body = "
" + std::string(months[size_t(m - 1)]) + " " + std::to_string(y) + "
" + weekdays[std::chrono::weekday{std::chrono::sys_days(ymd)}.c_encoding()] + "" + std::to_string(d) + "" + esc(meta.at("season").at("label").get()) + "
"; } else if (id == "account") { const auto savings = desk.at("accounts").at("savings"); - body = widget_heading("Vereinskasse", false) + ""; + body = widget_heading("Vereinskasse", false) + ""; } else if (id == "opponent-crest" && desk.at("nextFixture").is_object()) { const auto &next = desk.at("nextFixture"); const auto &other = next.at(next.at("home").at("id") == team.at("id") ? "away" : "home"); diff --git a/src/modern/ui/screens.inc b/src/modern/ui/screens.inc index 932ffe8..aec05e4 100644 --- a/src/modern/ui/screens.inc +++ b/src/modern/ui/screens.inc @@ -55,7 +55,7 @@ std::string App::render_desktop() { "identity", "id=\"desktop-identity\"") + "
" + std::string(widget_data_.at("matchday")==0?"Saisonvorbereitung":std::to_string(widget_data_.at("matchday").get())+". Spieltag") + "" + esc(widget_data_.at("season").get()) + - "
"+std::string(national?"Aufgabenbereich":"Guthaben")+"" + + "
"+std::string(national?"Aufgabenbereich":"Guthaben")+"()) + "\">" + (national?std::string("Nationalmannschaft"):cash(s.state.value("cash", int64_t(0)))) + "
"; if(desktop_.value("grid",true))for(int row=0;row<7;++row)for(int col=0;col<15;++col)out+=""; for (const auto &[id, o] : desktop_["objects"].items()) { @@ -139,7 +139,7 @@ std::string App::render_camp() { stars + ""; } body += "
Preis" + + "class=\"money-amount\">" + (chosen->at("price").is_null() ? std::string("—") : (engine_mode_ ? money(chosen->at("price").get(), {{"code", "EUR"}, {"minor_units", 2}}) : cash(chosen->at("price").get()))) + "
"; const std::array focus = {"Kondition", "Technik", "Spiel", "Erholung"}; diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index 3c94389..646e9fa 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -66,6 +66,7 @@ namespace bmh::modern_ui { namespace { std::string esc(std::string_view value) { return editor::escaped(value); } +std::string money_classes(int64_t value) { return value < 0 ? "money-amount is-negative" : "money-amount"; } std::string scalar(double n) { std::ostringstream s; s.imbue(std::locale::classic()); diff --git a/src/modern/ui/widgets_screens.inc b/src/modern/ui/widgets_screens.inc index 7fd2606..f352940 100644 --- a/src/modern/ui/widgets_screens.inc +++ b/src/modern/ui/widgets_screens.inc @@ -97,7 +97,7 @@ std::string App::widget(const std::string &id, const Json &o) { glyph("arrow-diagonal", 26) + ""; if (id == "account") return heading("Vereinskasse") + - "