From b5f1ca169567f47b3976de5b4c5a2b1ce37656d5 Mon Sep 17 00:00:00 2001 From: Alexander van Saase Date: Mon, 2 Oct 2023 20:18:15 +0200 Subject: Introduce support for disabling a `checkbox` --- style/src/theme.rs | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'style/src/theme.rs') diff --git a/style/src/theme.rs b/style/src/theme.rs index 8d1ff237..e003a93b 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -319,7 +319,7 @@ impl checkbox::StyleSheet for Theme { Checkbox::Secondary => checkbox_appearance( palette.background.base.text, palette.background.base, - palette.background.base, + palette.background.weak, is_checked, ), Checkbox::Success => checkbox_appearance( @@ -355,7 +355,7 @@ impl checkbox::StyleSheet for Theme { Checkbox::Secondary => checkbox_appearance( palette.background.base.text, palette.background.weak, - palette.background.base, + palette.background.weak, is_checked, ), Checkbox::Success => checkbox_appearance( @@ -373,6 +373,42 @@ impl checkbox::StyleSheet for Theme { Checkbox::Custom(custom) => custom.hovered(self, is_checked), } } + + fn disabled( + &self, + style: &Self::Style, + is_checked: bool, + ) -> checkbox::Appearance { + let palette = self.extended_palette(); + + match style { + Checkbox::Primary => checkbox_appearance( + palette.primary.strong.text, + palette.background.weak, + palette.background.strong, + is_checked, + ), + Checkbox::Secondary => checkbox_appearance( + palette.background.strong.color, + palette.background.weak, + palette.background.weak, + is_checked, + ), + Checkbox::Success => checkbox_appearance( + palette.success.base.text, + palette.background.weak, + palette.success.weak, + is_checked, + ), + Checkbox::Danger => checkbox_appearance( + palette.danger.base.text, + palette.background.weak, + palette.danger.weak, + is_checked, + ), + Checkbox::Custom(custom) => custom.active(self, is_checked), + } + } } fn checkbox_appearance( -- cgit From d0e94419b55002be6069c0cb206bb40c47681479 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 1 Feb 2024 13:13:21 +0100 Subject: Use strong background for `Secondary` checkbox accent --- style/src/theme.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'style/src/theme.rs') diff --git a/style/src/theme.rs b/style/src/theme.rs index e003a93b..166410ae 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -319,7 +319,7 @@ impl checkbox::StyleSheet for Theme { Checkbox::Secondary => checkbox_appearance( palette.background.base.text, palette.background.base, - palette.background.weak, + palette.background.strong, is_checked, ), Checkbox::Success => checkbox_appearance( @@ -355,7 +355,7 @@ impl checkbox::StyleSheet for Theme { Checkbox::Secondary => checkbox_appearance( palette.background.base.text, palette.background.weak, - palette.background.weak, + palette.background.strong, is_checked, ), Checkbox::Success => checkbox_appearance( -- cgit