fix: do not double paint menu item background
This commit is contained in:
parent
6af8b7051b
commit
5a8bd9482a
1 changed files with 8 additions and 3 deletions
|
|
@ -38,6 +38,10 @@ pub enum Button {
|
||||||
Transparent,
|
Transparent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn menu_item_background(component: &Component, background: Color) -> Option<Background> {
|
||||||
|
(background != Color::from(component.base)).then_some(Background::Color(background))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn appearance(
|
pub fn appearance(
|
||||||
theme: &crate::Theme,
|
theme: &crate::Theme,
|
||||||
focused: bool,
|
focused: bool,
|
||||||
|
|
@ -149,7 +153,7 @@ pub fn appearance(
|
||||||
// Menu folders cannot be disabled, ignore customized icon and text color
|
// Menu folders cannot be disabled, ignore customized icon and text color
|
||||||
let component = &cosmic.background(theme.transparent).component;
|
let component = &cosmic.background(theme.transparent).component;
|
||||||
let (background, _, _) = color(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.icon_color = Some(component.on.into());
|
||||||
appearance.text_color = Some(component.on.into());
|
appearance.text_color = Some(component.on.into());
|
||||||
corner_radii = &cosmic.corner_radii.radius_s;
|
corner_radii = &cosmic.corner_radii.radius_s;
|
||||||
|
|
@ -171,8 +175,9 @@ pub fn appearance(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button::MenuItem => {
|
Button::MenuItem => {
|
||||||
let (background, text, icon) = color(&cosmic.background(theme.transparent).component);
|
let component = &cosmic.background(theme.transparent).component;
|
||||||
appearance.background = Some(Background::Color(background));
|
let (background, text, icon) = color(component);
|
||||||
|
appearance.background = menu_item_background(component, background);
|
||||||
appearance.icon_color = icon;
|
appearance.icon_color = icon;
|
||||||
appearance.text_color = text;
|
appearance.text_color = text;
|
||||||
corner_radii = &cosmic.corner_radii.radius_s;
|
corner_radii = &cosmic.corner_radii.radius_s;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue