diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index f361512d..b46b22d7 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -38,6 +38,10 @@ pub enum Button { Transparent, } +fn menu_item_background(component: &Component, background: Color) -> Option { + (background != Color::from(component.base)).then_some(Background::Color(background)) +} + pub fn appearance( theme: &crate::Theme, focused: bool, @@ -149,7 +153,7 @@ pub fn appearance( // Menu folders cannot be disabled, ignore customized icon and text color let component = &cosmic.background(theme.transparent).component; let (background, _, _) = color(component); - appearance.background = Some(Background::Color(background)); + appearance.background = menu_item_background(component, background); appearance.icon_color = Some(component.on.into()); appearance.text_color = Some(component.on.into()); corner_radii = &cosmic.corner_radii.radius_s; @@ -171,8 +175,9 @@ pub fn appearance( } } Button::MenuItem => { - let (background, text, icon) = color(&cosmic.background(theme.transparent).component); - appearance.background = Some(Background::Color(background)); + let component = &cosmic.background(theme.transparent).component; + let (background, text, icon) = color(component); + appearance.background = menu_item_background(component, background); appearance.icon_color = icon; appearance.text_color = text; corner_radii = &cosmic.corner_radii.radius_s;