refactor: remove extra opacity where it was added
This commit is contained in:
parent
732785a50c
commit
2d7f66d528
4 changed files with 31 additions and 10 deletions
|
|
@ -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()),
|
||||
|
|
|
|||
|
|
@ -389,7 +389,9 @@ pub enum Container<'a> {
|
|||
WindowBackground,
|
||||
Background,
|
||||
Card,
|
||||
ContextDrawer,
|
||||
ContextDrawer {
|
||||
transparent: bool,
|
||||
},
|
||||
Custom(Box<dyn Fn(&Theme) -> 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.;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,24 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
|
|||
on_close: Message,
|
||||
max_width: f32,
|
||||
) -> Element<'a, Message>
|
||||
where
|
||||
Drawer: Into<Element<'a, Message>>,
|
||||
{
|
||||
Self::new_inner_overlay(
|
||||
title, actions, header, footer, drawer, on_close, max_width, false,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_inner_overlay<Drawer>(
|
||||
title: Option<Cow<'a, str>>,
|
||||
actions: Option<Element<'a, Message>>,
|
||||
header: Option<Element<'a, Message>>,
|
||||
footer: Option<Element<'a, Message>>,
|
||||
drawer: Drawer,
|
||||
on_close: Message,
|
||||
max_width: f32,
|
||||
overlay: bool,
|
||||
) -> Element<'a, Message>
|
||||
where
|
||||
Drawer: Into<Element<'a, Message>>,
|
||||
{
|
||||
|
|
@ -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<Element<'a, Message>>,
|
||||
Drawer: Into<Element<'a, Message>>,
|
||||
{
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue