From a104d1e34003fc0454f8828cc51e91f4bfda8958 Mon Sep 17 00:00:00 2001 From: noah Date: Sat, 19 Sep 2026 20:53:28 -0600 Subject: [PATCH] GUI round 11: KPI icons match their card text colour + recolour SVGs without a fill - Each KPI icon now uses its card's value colour (dropped the amber special-case), so the otter matches the Paused text colour and the lightning bolt matches the Est-power text colour, etc. - svg_recolored also injects a root fill: some Font Awesome exports (e.g. the Free otter) omit fill entirely and default to black, so replacing currentColor alone left them black. Now shapes without their own fill inherit the card colour. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh --- crates/alkane-gui/src/ui.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index aef4845b..88934dd3 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -295,13 +295,13 @@ const SVG_OTTER: &str = include_str!("../assets/icons/otter.svg"); const SVG_HIVE: &str = include_str!("../assets/icons/hive.svg"); const SVG_BOLT: &str = include_str!("../assets/icons/bolt.svg"); -/// Replace an SVG's `currentColor` fill with an explicit hex colour so it renders -/// in the KPI card's colour (round 11 #15). +/// Recolour an SVG to the KPI card's colour (round 11 #15). Some Font Awesome +/// exports use fill="currentColor" (replaced here); others omit fill entirely and +/// default to black, so a root `fill` is also injected for shapes to inherit. fn svg_recolored(svg: &str, color: (u8, u8, u8)) -> String { - svg.replace( - "currentColor", - &format!("#{:02X}{:02X}{:02X}", color.0, color.1, color.2), - ) + let hex = format!("#{:02X}{:02X}{:02X}", color.0, color.1, color.2); + let s = svg.replace("currentColor", &hex); + s.replacen(" App { let row = Widget::box_sizer(false); row.add_stretch(1); if let Some(svg) = icon { - // Neutral cards (Est. power) colour the icon amber so the bolt - // reads; the rest take the card's value colour. - let icol = if matches!(kind, ColorKind::Neutral) { pal.amber } else { vc }; + // Icon takes the card's value colour, so each icon matches its KPI + // text (otter = paused colour, bolt = est-power colour, etc.). + let icol = vc; let h = 20; let ic = Widget::svg_icon(card, &svg_recolored(svg, icol), svg_width_for_height(svg, h), h); row.add(ic, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_RIGHT, 5);