fix(menu_bar): root text will inherit icon color from header

This commit is contained in:
Michael Aaron Murphy 2024-05-21 04:34:35 +02:00
parent aa3f5d3401
commit f9f8eb51cb
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
8 changed files with 26 additions and 24 deletions

View file

@ -120,8 +120,8 @@ pub fn appearance(
}
Button::MenuRoot => {
appearance.background = None;
appearance.icon_color = Some(cosmic.accent.base.into());
appearance.text_color = Some(cosmic.accent.base.into());
appearance.icon_color = None;
appearance.text_color = None;
}
Button::MenuItem => {
let (background, _, _) = color(&cosmic.background.component);

View file

@ -19,7 +19,7 @@ pub struct Appearance {
pub border_color: Color,
/// The expand value of the menus' background
pub background_expand: [u16; 4],
/// The highlighted path [`Color`] of the the menu bar and its menus.
// /// The highlighted path [`Color`] of the the menu bar and its menus.
pub path: Color,
}

View file

@ -375,7 +375,13 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
};
let mut icon_color = styling.icon_color.unwrap_or(renderer_style.icon_color);
let mut text_color = styling.text_color.unwrap_or(renderer_style.text_color);
// Menu roots should share the accent color that icons get in the header.
let mut text_color = if matches!(self.style, crate::theme::Button::MenuRoot) {
icon_color
} else {
styling.text_color.unwrap_or(renderer_style.text_color)
};
if let Some(alpha) = headerbar_alpha {
icon_color.a = alpha;

View file

@ -1,5 +1,3 @@
use crate::widget::segmented_button::Entity;
/// `MenuAction` is a trait that represents an action in a menu.
///
/// It is used to define the behavior of menu items when they are activated.

View file

@ -390,8 +390,8 @@ where
},
shadow: Default::default(),
};
let path_color = styling.path;
renderer.fill_quad(path_quad, path_color);
renderer.fill_quad(path_quad, styling.path);
}
}

View file

@ -709,8 +709,8 @@ where
},
shadow: Shadow::default(),
};
let path_color = styling.path;
r.fill_quad(path_quad, path_color);
r.fill_quad(path_quad, styling.path);
}
// draw item