Merge pull request #3112 from edwloef/container-default-style-snap

make default container style respect `crisp` feature
This commit is contained in:
Héctor 2025-11-12 22:09:40 +01:00 committed by GitHub
commit fc80f697b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -458,7 +458,7 @@ pub fn draw_background<Renderer>(
}
/// The appearance of a container.
#[derive(Debug, Clone, Copy, PartialEq, Default)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Style {
/// The text [`Color`] of the container.
pub text_color: Option<Color>,
@ -472,6 +472,18 @@ pub struct Style {
pub snap: bool,
}
impl Default for Style {
fn default() -> Self {
Self {
text_color: None,
background: None,
border: Border::default(),
shadow: Shadow::default(),
snap: cfg!(feature = "crisp"),
}
}
}
impl Style {
/// Updates the text color of the [`Style`].
pub fn color(self, color: impl Into<Color>) -> Self {