Merge pull request #2607 from DavidAguilo/palette_warning

Feat: Add warning color to palette
This commit is contained in:
Héctor 2025-01-06 21:13:08 +01:00 committed by GitHub
commit b156087fcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 129 additions and 5 deletions

View file

@ -633,6 +633,21 @@ pub fn success(theme: &Theme, status: Status) -> Style {
}
}
/// A warning button; denoting a risky action.
pub fn warning(theme: &Theme, status: Status) -> Style {
let palette = theme.extended_palette();
let base = styled(palette.warning.base);
match status {
Status::Active | Status::Pressed => base,
Status::Hovered => Style {
background: Some(Background::Color(palette.warning.strong.color)),
..base
},
Status::Disabled => disabled(base),
}
}
/// A danger button; denoting a destructive action.
pub fn danger(theme: &Theme, status: Status) -> Style {
let palette = theme.extended_palette();