feat(blur): better align with designs and remove transparency from theme when not on wayland

This commit is contained in:
Ashley Wulber 2026-04-14 23:44:01 -04:00 • committed by Ashley Wulber
parent 439109db04
commit d0b164d216
7 changed files with 222 additions and 41 deletions

View file

@ -290,6 +290,29 @@ impl Theme {
pub fn set_theme(&mut self, theme: ThemeType) {
self.theme_type = theme;
}
pub fn into_opaque(&self) -> Self {
let mut new_theme = Theme {
theme_type: match &self.theme_type {
ThemeType::System { theme, prefer_dark } => {
let mut new_t = (**theme).clone();
new_t.background.base.alpha = 1.0;
new_t.primary.base.alpha = 1.0;
new_t.secondary.base.alpha = 1.0;
ThemeType::System {
theme: Arc::new(new_t),
prefer_dark: *prefer_dark,
}
}
other => other.clone(),
},
layer: self.layer,
};
let cosmic = new_theme.cosmic();
// copy theme but make all container colors opaque
new_theme
}
}
impl LayeredTheme for Theme {

View file

@ -477,7 +477,21 @@ impl iced_container::Catalog for Theme {
let window_corner_radius = cosmic.radius_s().map(|x| if x < 4.0 { x } else { x + 4.0 });
match class {
Container::Transparent => iced_container::Style::default(),
Container::Transparent => {
let component = &self.current_container().component;
iced_container::Style {
icon_color: Some(component.on.into()),
text_color: Some(component.on.into()),
background: None,
border: Border {
radius: 0.into(),
..Default::default()
},
shadow: Shadow::default(),
snap: true,
}
}
Container::Custom(f) => f(self),
@ -565,7 +579,7 @@ impl iced_container::Catalog for Theme {
Container::ContextDrawer => {
let mut a = Container::primary(cosmic);
if let Some(Background::Color(ref mut color)) = a.background {
color.a = 1.;
color.a = (color.a + if cosmic.is_dark { 0.60 } else { 0.5 }).min(1.);
}
if cosmic.is_high_contrast {

View file

@ -65,10 +65,12 @@ impl StyleSheet for Theme {
fn appearance(&self, style: &Self::Style) -> Appearance {
let cosmic = self.cosmic();
let component = &cosmic.background.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 {
background: component.base.into(),
background: bg.into(),
border_width: 1.0,
bar_border_radius: cosmic.corner_radii.radius_xl,
menu_border_radius: cosmic.corner_radii.radius_s,