diff options
Diffstat (limited to 'style/src/checkbox.rs')
-rw-r--r-- | style/src/checkbox.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/style/src/checkbox.rs b/style/src/checkbox.rs index 82c1766f..77093f69 100644 --- a/style/src/checkbox.rs +++ b/style/src/checkbox.rs @@ -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 + } + } } |