Skip to content

Commit

Permalink
improv: window border corner appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
git-f0x authored and mmstick committed Nov 26, 2024
1 parent a9c7c3c commit af7157b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
10 changes: 7 additions & 3 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 4 additions & 22 deletions src/theme/style/iced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},

Expand Down Expand Up @@ -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(),
}
}
Expand Down

0 comments on commit af7157b

Please sign in to comment.