Skip to content

Commit

Permalink
Improve context menu styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Nov 20, 2023
1 parent 858bad0 commit 7782a42
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/menu.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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),
Expand All @@ -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()
}
Expand Down

0 comments on commit 7782a42

Please sign in to comment.