diff --git a/src/applet/mod.rs b/src/applet/mod.rs index 897ea7ca..37635bf4 100644 --- a/src/applet/mod.rs +++ b/src/applet/mod.rs @@ -373,7 +373,6 @@ impl Context { let cosmic = theme.cosmic(); let corners = cosmic.corner_radii; let mut bg = cosmic.background(theme.transparent).base; - bg.alpha = (bg.alpha + if cosmic.is_dark { 0.6 } else { 0.5 }).min(1.); iced_widget::container::Style { text_color: Some(cosmic.background(theme.transparent).on.into()), background: Some(Color::from(bg).into()), diff --git a/src/theme/style/iced.rs b/src/theme/style/iced.rs index a18068a4..bac6e275 100644 --- a/src/theme/style/iced.rs +++ b/src/theme/style/iced.rs @@ -389,7 +389,9 @@ pub enum Container<'a> { WindowBackground, Background, Card, - ContextDrawer, + ContextDrawer { + transparent: bool, + }, Custom(Box iced_container::Style + 'a>), Dialog, Dropdown, @@ -587,11 +589,8 @@ impl iced_container::Catalog for Theme { } } - Container::ContextDrawer => { - let mut a = Container::primary(cosmic, self.transparent); - if let Some(Background::Color(ref mut color)) = a.background { - color.a = (color.a + if cosmic.is_dark { 0.60 } else { 0.5 }).min(1.); - } + Container::ContextDrawer { transparent } => { + let mut a = Container::primary(cosmic, self.transparent && *transparent); if cosmic.is_high_contrast { a.border.width = 1.; diff --git a/src/theme/style/menu_bar.rs b/src/theme/style/menu_bar.rs index 2a618f6b..c6f40c52 100644 --- a/src/theme/style/menu_bar.rs +++ b/src/theme/style/menu_bar.rs @@ -66,7 +66,6 @@ impl StyleSheet for Theme { let cosmic = self.cosmic(); let component = &cosmic.background(self.transparent).component; let mut bg = component.base; - bg.alpha = (bg.alpha + if cosmic.is_dark { 0.6 } else { 0.5 }).min(1.); match style { MenuBarStyle::Default => Appearance { diff --git a/src/widget/context_drawer/widget.rs b/src/widget/context_drawer/widget.rs index 9a7448eb..b743c4eb 100644 --- a/src/widget/context_drawer/widget.rs +++ b/src/widget/context_drawer/widget.rs @@ -31,6 +31,24 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> { on_close: Message, max_width: f32, ) -> Element<'a, Message> + where + Drawer: Into>, + { + Self::new_inner_overlay( + title, actions, header, footer, drawer, on_close, max_width, false, + ) + } + + pub fn new_inner_overlay( + title: Option>, + actions: Option>, + header: Option>, + footer: Option>, + drawer: Drawer, + on_close: Message, + max_width: f32, + overlay: bool, + ) -> Element<'a, Message> where Drawer: Into>, { @@ -43,6 +61,7 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> { drawer: Element<'a, Message>, on_close: Message, max_width: f32, + overlay: bool, ) -> Element<'a, Message> { let cosmic_theme::Spacing { space_xxs, @@ -105,7 +124,9 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> { container( LayerContainer::new(pane) .layer(cosmic_theme::Layer::Primary) - .class(crate::style::Container::ContextDrawer) + .class(crate::style::Container::ContextDrawer { + transparent: !overlay, + }) .width(Length::Fill) .height(Length::Fill) .max_width(max_width), @@ -124,6 +145,7 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> { drawer.into(), on_close, max_width, + overlay, ) } @@ -142,7 +164,9 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> { Content: Into>, Drawer: Into>, { - let drawer = Self::new_inner(title, actions, header, footer, drawer, on_close, max_width); + let drawer = Self::new_inner_overlay( + title, actions, header, footer, drawer, on_close, max_width, true, + ); ContextDrawer { id: None,