Add subtle styling for button

This commit is contained in:
Héctor Ramón Jiménez 2025-08-02 20:52:31 +02:00
parent 83a7a50d8b
commit a39e76acba
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

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