diff --git a/Cargo.lock b/Cargo.lock index 196dceb..ce607dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4562,7 +4562,7 @@ dependencies = [ [[package]] name = "snapdash" -version = "0.0.9" +version = "0.0.10" dependencies = [ "anyhow", "auto-launch", diff --git a/Cargo.toml b/Cargo.toml index ca3f542..e282dc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "snapdash" -version = "0.0.9" +version = "0.0.10" edition = "2024" authors = ["Lukáš Svoboda "] license = "Apache-2.0" diff --git a/src/ui/entity_window.rs b/src/ui/entity_window.rs index db9c6f4..19d1a84 100644 --- a/src/ui/entity_window.rs +++ b/src/ui/entity_window.rs @@ -29,17 +29,22 @@ fn status_line(p: Palette, connected: bool) -> Element<'static, Message> { row![dot].spacing(8).align_y(Alignment::End).into() } -fn pulse_border(p: Palette, pulse: f32) -> iced::Color { +/// Ring pulse color for the card border. +/// +/// Normal/Low widgets rest faint and flash to accent on a state update +/// (dimmed → accent → dimmed). High-priority widgets rest on a steady +/// accent ring and *invert* the pulse — they dip to dimmed and return +/// (accent → dimmed → accent) — so the update feedback survives the +/// always-on emphasis ring. +fn pulse_border(p: Palette, pulse: f32, priority: Priority) -> iced::Color { let t = pulse.clamp(0.0, 1.0); - let a = 0.10 + 0.55 * t; + let a = match priority { + Priority::Low | Priority::Normal => 0.15 + 0.55 * t, + Priority::High => 0.65 - 0.50 * t, + }; - iced::Color { - r: p.accent.r, - g: p.accent.g, - b: p.accent.b, - a, - } + iced::Color { a, ..p.accent } } pub fn view( @@ -127,13 +132,7 @@ pub fn view( let disconnected_text = components::error_message("You are disconected from Home Assistant!", p); - let ring = match priority { - Priority::High => iced::Color { - a: 0.55, - ..p.accent - }, - _ => pulse_border(p, state.pulse.value()), - }; + let ring = pulse_border(p, state.pulse.value(), priority); let inner = column![ title_text,