improv: window border corner appearance

This commit is contained in:
Vukašin Vojinović 2024-11-25 02:36:11 +01:00 committed by Michael Murphy
parent a9c7c3cdbf
commit af7157b45a
2 changed files with 11 additions and 25 deletions

View file

@ -892,13 +892,17 @@ impl<App: Application> ApplicationExt for App {
.apply(container)
.padding(if sharp_corners { 0 } else { 1 })
.style(move |theme| container::Style {
icon_color: Some(iced::Color::from(theme.cosmic().background.on)),
text_color: Some(iced::Color::from(theme.cosmic().background.on)),
background: Some(iced::Background::Color(
theme.cosmic().background.base.into(),
)),
border: iced::Border {
color: theme.cosmic().bg_divider().into(),
width: if sharp_corners { 0.0 } else { 1.0 },
// x + 2.0 is used to prevent corner artifacts
radius: theme.cosmic().radius_s().map(|x| x + 2.0).into(),
radius: theme.cosmic().radius_s().into(),
},
..Default::default()
shadow: iced::Shadow::default(),
});
// Show any current dialog on top and centered over the view content

View file

@ -469,17 +469,8 @@ impl iced_container::Catalog for Theme {
Container::WindowBackground => iced_container::Style {
icon_color: Some(Color::from(cosmic.background.on)),
text_color: Some(Color::from(cosmic.background.on)),
background: Some(iced::Background::Color(cosmic.background.base.into())),
border: Border {
radius: [
cosmic.corner_radii.radius_0[0],
cosmic.corner_radii.radius_0[1],
cosmic.corner_radii.radius_s[2],
cosmic.corner_radii.radius_s[3],
]
.into(),
..Default::default()
},
background: None,
border: Border::default(),
shadow: Shadow::default(),
},
@ -513,17 +504,8 @@ impl iced_container::Catalog for Theme {
iced_container::Style {
icon_color: Some(icon_color),
text_color: Some(text_color),
background: Some(iced::Background::Color(cosmic.background.base.into())),
border: Border {
radius: [
cosmic.corner_radii.radius_s[0],
cosmic.corner_radii.radius_s[1],
cosmic.corner_radii.radius_0[2],
cosmic.corner_radii.radius_0[3],
]
.into(),
..Default::default()
},
background: None,
border: Border::default(),
shadow: Shadow::default(),
}
}