bap
This commit is contained in:
@@ -35,19 +35,20 @@ impl Battery {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Icon ink: green while charging, white otherwise.
|
/// Icon ink: the theme's success green while charging, bar text otherwise.
|
||||||
fn ink(status: BatteryStatus) -> Color {
|
fn ink(status: BatteryStatus, theme: &Theme) -> Color {
|
||||||
|
let palette = theme.palette();
|
||||||
match status {
|
match status {
|
||||||
BatteryStatus::Charging => Color::from_rgb8(0x76, 0xFF, 0x03),
|
BatteryStatus::Charging => palette.success,
|
||||||
_ => Color::WHITE,
|
_ => palette.text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Transparent shell with a rounded outline tinted by charge state.
|
/// Transparent shell with a rounded outline tinted by charge state.
|
||||||
fn shell_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style {
|
fn shell_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style {
|
||||||
move |_theme: &Theme| container::Style {
|
move |theme: &Theme| container::Style {
|
||||||
border: Border {
|
border: Border {
|
||||||
color: ink(status),
|
color: ink(status, theme),
|
||||||
width: BORDER_W,
|
width: BORDER_W,
|
||||||
radius: 4.0.into(),
|
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.
|
/// Solid fill (and nub cap) tinted by charge state.
|
||||||
fn solid_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style {
|
fn solid_style(status: BatteryStatus) -> impl Fn(&Theme) -> container::Style {
|
||||||
move |_theme: &Theme| container::Style {
|
move |theme: &Theme| container::Style {
|
||||||
background: Some(ink(status).into()),
|
background: Some(ink(status, theme).into()),
|
||||||
border: Border {
|
border: Border {
|
||||||
radius: 2.0.into(),
|
radius: 2.0.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|||||||
Reference in New Issue
Block a user