bap
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user