diff options
author | 2024-01-20 13:52:15 +0100 | |
---|---|---|
committer | 2024-01-20 13:52:15 +0100 | |
commit | 545cc909c9f356dd733d273173694db9b8c28594 (patch) | |
tree | c8132edab4386bbccb07a372c3776f22abefbda3 /style/src/theme.rs | |
parent | b3e3f6e3c9fc6879e6681810f54d7eaa7c0f3d30 (diff) | |
parent | 1c1667c3c99fa9b1009ef416b9b3c7e5a1d53a97 (diff) | |
download | iced-545cc909c9f356dd733d273173694db9b8c28594.tar.gz iced-545cc909c9f356dd733d273173694db9b8c28594.tar.bz2 iced-545cc909c9f356dd733d273173694db9b8c28594.zip |
Merge pull request #1882 from nicksenger/shadows
Quad shadows
Diffstat (limited to 'style/src/theme.rs')
-rw-r--r-- | style/src/theme.rs | 129 |
1 files changed, 73 insertions, 56 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index f78587e5..8d1ff237 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -21,7 +21,7 @@ use crate::text_editor; use crate::text_input; use crate::toggler; -use iced_core::{Background, Color, Vector}; +use crate::core::{Background, Border, Color, Shadow, Vector}; use std::fmt; use std::rc::Rc; @@ -199,7 +199,7 @@ impl button::StyleSheet for Theme { let palette = self.extended_palette(); let appearance = button::Appearance { - border_radius: 2.0.into(), + border: Border::with_radius(2), ..button::Appearance::default() }; @@ -388,9 +388,11 @@ fn checkbox_appearance( base.color }), icon_color, - border_radius: 2.0.into(), - border_width: 1.0, - border_color: accent.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: accent.color, + }, text_color: None, } } @@ -431,9 +433,8 @@ impl container::StyleSheet for Theme { container::Appearance { text_color: None, background: Some(palette.background.weak.color.into()), - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, + border: Border::with_radius(2), + shadow: Shadow::default(), } } Container::Custom(custom) => custom.appearance(self), @@ -555,9 +556,11 @@ impl menu::StyleSheet for Theme { menu::Appearance { text_color: palette.background.weak.text, background: palette.background.weak.color.into(), - border_width: 1.0, - border_radius: 0.0.into(), - border_color: palette.background.strong.color, + border: Border { + width: 1.0, + radius: 0.0.into(), + color: palette.background.strong.color, + }, selected_text_color: palette.primary.strong.text, selected_background: palette.primary.strong.color.into(), } @@ -602,9 +605,11 @@ impl pick_list::StyleSheet for Theme { background: palette.background.weak.color.into(), placeholder_color: palette.background.strong.color, handle_color: palette.background.weak.text, - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.strong.color, + }, } } PickList::Custom(custom, _) => custom.active(self), @@ -621,9 +626,11 @@ impl pick_list::StyleSheet for Theme { background: palette.background.weak.color.into(), placeholder_color: palette.background.strong.color, handle_color: palette.background.weak.text, - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.primary.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.primary.strong.color, + }, } } PickList::Custom(custom, _) => custom.hovered(self), @@ -776,9 +783,11 @@ impl pane_grid::StyleSheet for Theme { a: 0.5, ..palette.primary.base.color }), - border_width: 2.0, - border_color: palette.primary.strong.color, - border_radius: 0.0.into(), + border: Border { + width: 2.0, + color: palette.primary.strong.color, + radius: 0.0.into(), + }, } } PaneGrid::Custom(custom) => custom.hovered_region(self), @@ -986,14 +995,10 @@ impl scrollable::StyleSheet for Theme { scrollable::Scrollbar { background: Some(palette.background.weak.color.into()), - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, + border: Border::with_radius(2), scroller: scrollable::Scroller { color: palette.background.strong.color, - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, + border: Border::with_radius(2), }, } } @@ -1013,14 +1018,10 @@ impl scrollable::StyleSheet for Theme { scrollable::Scrollbar { background: Some(palette.background.weak.color.into()), - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, + border: Border::with_radius(2), scroller: scrollable::Scroller { color: palette.primary.strong.color, - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, + border: Border::with_radius(2), }, } } else { @@ -1120,9 +1121,11 @@ impl text_input::StyleSheet for Theme { text_input::Appearance { background: palette.background.base.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.strong.color, + }, icon_color: palette.background.weak.text, } } @@ -1136,9 +1139,11 @@ impl text_input::StyleSheet for Theme { text_input::Appearance { background: palette.background.base.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.base.text, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.base.text, + }, icon_color: palette.background.weak.text, } } @@ -1152,9 +1157,11 @@ impl text_input::StyleSheet for Theme { text_input::Appearance { background: palette.background.base.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.primary.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.primary.strong.color, + }, icon_color: palette.background.weak.text, } } @@ -1198,9 +1205,11 @@ impl text_input::StyleSheet for Theme { text_input::Appearance { background: palette.background.weak.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.strong.color, + }, icon_color: palette.background.strong.color, } } @@ -1236,9 +1245,11 @@ impl text_editor::StyleSheet for Theme { text_editor::Appearance { background: palette.background.base.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.strong.color, + }, } } @@ -1251,9 +1262,11 @@ impl text_editor::StyleSheet for Theme { text_editor::Appearance { background: palette.background.base.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.base.text, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.base.text, + }, } } @@ -1266,9 +1279,11 @@ impl text_editor::StyleSheet for Theme { text_editor::Appearance { background: palette.background.base.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.primary.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.primary.strong.color, + }, } } @@ -1311,9 +1326,11 @@ impl text_editor::StyleSheet for Theme { text_editor::Appearance { background: palette.background.weak.color.into(), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: palette.background.strong.color, + border: Border { + radius: 2.0.into(), + width: 1.0, + color: palette.background.strong.color, + }, } } |