Improve context menu styling
This commit is contained in:
parent
858bad0f50
commit
7782a421a3
1 changed files with 16 additions and 5 deletions
21
src/menu.rs
21
src/menu.rs
|
|
@ -1,11 +1,10 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cosmic::{
|
||||
cosmic_theme,
|
||||
//TODO: export in cosmic::widget
|
||||
iced::{
|
||||
widget::{column, horizontal_rule},
|
||||
Alignment, Length,
|
||||
Alignment, Background, Length,
|
||||
},
|
||||
theme,
|
||||
widget::{
|
||||
|
|
@ -50,7 +49,7 @@ pub fn context_menu<'a>(config: &Config, entity: segmented_button::Entity) -> El
|
|||
.on_press(Message::TabContextAction(entity, action))
|
||||
};
|
||||
|
||||
widget::cosmic_container::container(column!(
|
||||
widget::container(column!(
|
||||
menu_item(fl!("undo"), Action::Undo),
|
||||
menu_item(fl!("redo"), Action::Redo),
|
||||
horizontal_rule(1),
|
||||
|
|
@ -59,8 +58,20 @@ pub fn context_menu<'a>(config: &Config, entity: segmented_button::Entity) -> El
|
|||
menu_item(fl!("paste"), Action::Paste),
|
||||
menu_item(fl!("select-all"), Action::SelectAll),
|
||||
))
|
||||
.layer(cosmic_theme::Layer::Background)
|
||||
.style(theme::Container::Card)
|
||||
.padding(1)
|
||||
//TODO: move style to libcosmic
|
||||
.style(theme::Container::custom(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
let component = &cosmic.background.component;
|
||||
widget::container::Appearance {
|
||||
icon_color: Some(component.on.into()),
|
||||
text_color: Some(component.on.into()),
|
||||
background: Some(Background::Color(component.base.into())),
|
||||
border_radius: 8.0.into(),
|
||||
border_width: 1.0,
|
||||
border_color: component.divider.into(),
|
||||
}
|
||||
}))
|
||||
.width(Length::Fixed(240.0))
|
||||
.into()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue