Add subtle styling for button
This commit is contained in:
parent
83a7a50d8b
commit
a39e76acba
1 changed files with 23 additions and 0 deletions
|
|
@ -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)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue