From d02a4fefff319a3bd20936f9be30c4913bf49bab Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 19 Mar 2024 11:11:32 -0400 Subject: [PATCH] fix: selected images should have a border --- src/theme/style/button.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index afd9dffb..b2e33689 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -39,6 +39,7 @@ pub enum Button { pub fn appearance( theme: &crate::Theme, focused: bool, + selected: bool, style: &Button, color: impl Fn(&Component) -> (Color, Option, Option), ) -> Appearance { @@ -86,7 +87,7 @@ pub fn appearance( corner_radii = &cosmic.corner_radii.radius_s; appearance.border_radius = (*corner_radii).into(); - if focused { + if focused || selected { appearance.border_width = 2.0; appearance.border_color = cosmic.accent.base.into(); } @@ -153,7 +154,7 @@ impl StyleSheet for crate::Theme { } let accent = self.cosmic().accent_color(); - appearance(self, focused, style, |component| { + appearance(self, focused, selected, style, |component| { let text_color = if matches!( style, Button::Icon | Button::IconVertical | Button::HeaderBar @@ -177,7 +178,7 @@ impl StyleSheet for crate::Theme { return disabled(self); } - appearance(self, false, style, |component| { + appearance(self, false, false, style, |component| { let mut background = Color::from(component.base); background.a *= 0.5; ( @@ -201,6 +202,7 @@ impl StyleSheet for crate::Theme { appearance( self, focused || matches!(style, Button::Image), + selected, style, |component| { let text_color = if matches!( @@ -228,7 +230,7 @@ impl StyleSheet for crate::Theme { } let accent = self.cosmic().accent_button.pressed; - appearance(self, focused, style, |component| { + appearance(self, focused, selected, style, |component| { let text_color = if matches!( style, Button::Icon | Button::IconVertical | Button::HeaderBar