Add default disabled implementation to checkbox::StyleSheet
This commit is contained in:
parent
7a4e86a7ab
commit
a0103a8693
1 changed files with 16 additions and 1 deletions
|
|
@ -26,5 +26,20 @@ pub trait StyleSheet {
|
|||
fn hovered(&self, style: &Self::Style, is_checked: bool) -> Appearance;
|
||||
|
||||
/// Produces the disabled [`Appearance`] of a checkbox.
|
||||
fn disabled(&self, style: &Self::Style, is_checked: bool) -> Appearance;
|
||||
fn disabled(&self, style: &Self::Style, is_checked: bool) -> Appearance {
|
||||
let active = self.active(style, is_checked);
|
||||
|
||||
Appearance {
|
||||
background: match active.background {
|
||||
Background::Color(color) => Background::Color(Color {
|
||||
a: color.a * 0.5,
|
||||
..color
|
||||
}),
|
||||
Background::Gradient(gradient) => {
|
||||
Background::Gradient(gradient.mul_alpha(0.5))
|
||||
}
|
||||
},
|
||||
..active
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue