fix: do not double paint menu item background

This commit is contained in:
Hojjat 2026-09-17 13:30:20 -06:00 • committed by Michael Murphy
parent 6af8b7051b
commit 5a8bd9482a

View file

@ -38,6 +38,10 @@ pub enum Button {
Transparent,
}
fn menu_item_background(component: &Component, background: Color) -> Option<Background> {
(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;