diff options
author | 2022-06-07 04:51:44 +0200 | |
---|---|---|
committer | 2022-06-07 04:51:44 +0200 | |
commit | 396735b682433928f52ba777891e14f2fbc703c7 (patch) | |
tree | bd275980a2fe6bc2efa7288f08db007dcaa7b6a4 /style/src/theme.rs | |
parent | 97555e67af8b4bcc77df69c5e72156e14948150e (diff) | |
download | iced-396735b682433928f52ba777891e14f2fbc703c7.tar.gz iced-396735b682433928f52ba777891e14f2fbc703c7.tar.bz2 iced-396735b682433928f52ba777891e14f2fbc703c7.zip |
Implement theme styling for `PickList` and `Menu`
Diffstat (limited to '')
-rw-r--r-- | style/src/theme.rs | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index 0e9a5964..b1e18c55 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -6,7 +6,9 @@ use crate::application; use crate::button; use crate::checkbox; use crate::container; +use crate::menu; use crate::pane_grid; +use crate::pick_list; use crate::progress_bar; use crate::radio; use crate::rule; @@ -328,6 +330,61 @@ impl slider::StyleSheet for Theme { } /* + * Menu + */ +impl menu::StyleSheet for Theme { + type Style = (); + + fn appearance(&self, _style: Self::Style) -> menu::Appearance { + let palette = self.extended_palette(); + + menu::Appearance { + text_color: palette.background.weak.text, + background: palette.background.weak.color.into(), + border_width: 1.0, + border_color: palette.background.strong.color, + selected_text_color: palette.primary.strong.text, + selected_background: palette.primary.strong.color.into(), + } + } +} + +/* + * Pick List + */ +impl pick_list::StyleSheet for Theme { + type Style = (); + + fn active(&self, _style: ()) -> pick_list::Appearance { + let palette = self.extended_palette(); + + pick_list::Appearance { + text_color: palette.background.weak.text, + background: palette.background.weak.color.into(), + placeholder_color: palette.background.strong.color, + border_radius: 2.0, + border_width: 1.0, + border_color: palette.background.strong.color, + icon_size: 0.7, + } + } + + fn hovered(&self, _style: ()) -> pick_list::Appearance { + let palette = self.extended_palette(); + + pick_list::Appearance { + text_color: palette.background.weak.text, + background: palette.background.weak.color.into(), + placeholder_color: palette.background.strong.color, + border_radius: 2.0, + border_width: 1.0, + border_color: palette.primary.strong.color, + icon_size: 0.7, + } + } +} + +/* * Radio */ impl radio::StyleSheet for Theme { @@ -506,7 +563,6 @@ impl rule::StyleSheet for Theme { /* * Scrollable */ - impl scrollable::StyleSheet for Theme { type Style = (); |