summaryrefslogtreecommitdiffstats
path: root/style/src/theme.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-04-12 04:51:19 +0200
committerLibravatar GitHub <noreply@github.com>2023-04-12 04:51:19 +0200
commitce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a (patch)
treef9be0c6e0d8f9e2af6170f4370677918c4b43a2a /style/src/theme.rs
parentca828f03f5aab9efacc9d63d4149363333035a0c (diff)
parent7e7e66586d990788ffd77b17e98357e74252f497 (diff)
downloadiced-ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a.tar.gz
iced-ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a.tar.bz2
iced-ce8e92ca7a4ed0f4fe284c9042f863f7c83ba03a.zip
Merge pull request #1744 from JungleTryne/disable-text-input
Add functionality to make `TextInput` disabled
Diffstat (limited to 'style/src/theme.rs')
-rw-r--r--style/src/theme.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index 0d974a19..6bd82a96 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -1093,4 +1093,28 @@ impl text_input::StyleSheet for Theme {
palette.primary.weak.color
}
+
+ fn disabled(&self, style: &Self::Style) -> text_input::Appearance {
+ if let TextInput::Custom(custom) = style {
+ return custom.disabled(self);
+ }
+
+ let palette = self.extended_palette();
+
+ text_input::Appearance {
+ background: palette.background.weak.color.into(),
+ border_radius: 2.0,
+ border_width: 1.0,
+ border_color: palette.background.strong.color,
+ icon_color: palette.background.strong.color,
+ }
+ }
+
+ fn disabled_color(&self, style: &Self::Style) -> Color {
+ if let TextInput::Custom(custom) = style {
+ return custom.disabled_color(self);
+ }
+
+ self.placeholder_color(style)
+ }
}