diff options
author | 2022-06-07 03:26:48 +0200 | |
---|---|---|
committer | 2022-06-07 03:26:48 +0200 | |
commit | de21a651c0616307bb6bfd36da1a06119e629b10 (patch) | |
tree | f565bfa3e75d57f6a4be1369d25dfd701b51c4ea /style/src/theme.rs | |
parent | ce53d3933c860cd958636cce415ac97c04aee746 (diff) | |
download | iced-de21a651c0616307bb6bfd36da1a06119e629b10.tar.gz iced-de21a651c0616307bb6bfd36da1a06119e629b10.tar.bz2 iced-de21a651c0616307bb6bfd36da1a06119e629b10.zip |
Implement theme styling for `Scrollable`
Diffstat (limited to '')
-rw-r--r-- | style/src/theme.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index e1ac719e..3eb4ea70 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -9,6 +9,7 @@ use crate::pane_grid; use crate::progress_bar; use crate::radio; use crate::rule; +use crate::scrollable; use crate::slider; use crate::text_input; use crate::toggler; @@ -459,6 +460,48 @@ impl rule::StyleSheet for Theme { } /* + * Scrollable + */ + +impl scrollable::StyleSheet for Theme { + type Style = (); + + fn active(&self, _style: Self::Style) -> scrollable::Scrollbar { + let palette = self.extended_palette(); + + scrollable::Scrollbar { + background: palette.background.weak.color.into(), + border_radius: 2.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + scroller: scrollable::Scroller { + color: palette.background.strong.color.into(), + border_radius: 2.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + }, + } + } + + fn hovered(&self, _style: Self::Style) -> scrollable::Scrollbar { + let palette = self.extended_palette(); + + scrollable::Scrollbar { + background: palette.background.weak.color.into(), + border_radius: 2.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + scroller: scrollable::Scroller { + color: palette.primary.strong.color.into(), + border_radius: 2.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + }, + } + } +} + +/* * Text Input */ impl text_input::StyleSheet for Theme { |