Add background styling for button

This commit is contained in:
Héctor Ramón Jiménez 2025-08-03 21:09:15 +02:00
parent 6b937fb6e1
commit c98f3d525a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
24 changed files with 45 additions and 24 deletions

View file

@ -688,7 +688,28 @@ pub fn text(theme: &Theme, status: Status) -> Style {
}
}
/// A subtle button using background shades.
/// A button using background shades.
pub fn background(theme: &Theme, status: Status) -> Style {
let palette = theme.extended_palette();
let base = styled(palette.background.base);
match status {
Status::Active => base,
Status::Pressed => Style {
background: Some(Background::Color(
palette.background.strong.color,
)),
..base
},
Status::Hovered => Style {
background: Some(Background::Color(palette.background.weak.color)),
..base
},
Status::Disabled => disabled(base),
}
}
/// A subtle button using weak background shades.
pub fn subtle(theme: &Theme, status: Status) -> Style {
let palette = theme.extended_palette();
let base = styled(palette.background.weakest);

View file

@ -712,7 +712,7 @@ pub fn bordered_box(theme: &Theme) -> Style {
border: Border {
width: 1.0,
radius: 5.0.into(),
color: palette.background.strong.color,
color: palette.background.weak.color,
},
..Style::default()
}