From 4d586d51377477c1c6636b6ced2d74204ef71987 Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Wed, 16 Sep 2026 11:29:30 +0100 Subject: [PATCH] bap --- crates/modules/src/battery.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/modules/src/battery.rs b/crates/modules/src/battery.rs index cc90616..b835676 100644 --- a/crates/modules/src/battery.rs +++ b/crates/modules/src/battery.rs @@ -35,19 +35,20 @@ impl Battery { } } -/// Icon ink: green while charging, white otherwise. -fn ink(status: BatteryStatus) -> Color { +/// Icon ink: the theme's success green while charging, bar text otherwise. +fn ink(status: BatteryStatus, theme: &Theme) -> Color { + let palette = theme.palette(); match status { - BatteryStatus::Charging => Color::from_rgb8(0x76, 0xFF, 0x03), - _ => Color::WHITE, + BatteryStatus::Charging => palette.success, + _ => palette.text, } } /// Transparent shell with a rounded outline tinted by charge state. fn shell_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style { - move |_theme: &Theme| container::Style { + move |theme: &Theme| container::Style { border: Border { - color: ink(status), + color: ink(status, theme), width: BORDER_W, radius: 4.0.into(), }, @@ -57,8 +58,8 @@ fn shell_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style { /// Solid fill (and nub cap) tinted by charge state. fn solid_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style { - move |_theme: &Theme| container::Style { - background: Some(ink(status).into()), + move |theme: &Theme| container::Style { + background: Some(ink(status, theme).into()), border: Border { radius: 2.0.into(), ..Default::default()