From b248fcc7fd71c730cab3d2aeadeff66ca63d7b15 Mon Sep 17 00:00:00 2001 From: Giuliano Bellini s294739 Date: Sat, 15 Apr 2023 10:45:25 +0200 Subject: [PATCH] minor improvements to slider and scrollbar stylesheets --- src/gui/pages/settings_notifications_page.rs | 4 ++-- src/gui/styles/scrollbar.rs | 8 ++++++-- src/gui/styles/slider.rs | 11 ++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/gui/pages/settings_notifications_page.rs b/src/gui/pages/settings_notifications_page.rs index da3c7570..c26a182c 100644 --- a/src/gui/pages/settings_notifications_page.rs +++ b/src/gui/pages/settings_notifications_page.rs @@ -425,9 +425,9 @@ fn volume_slider(language: Language, style: StyleType, volume: u8) -> Container< ElementType::Standard, ))), ) - .push(horizontal_space(Length::Fixed(10.0))) + .push(horizontal_space(Length::Fixed(15.0))) .push( - Text::new('Z'.to_string()) + Text::new("Z") .vertical_alignment(Vertical::Center) .size(20) .font(ICONS), diff --git a/src/gui/styles/scrollbar.rs b/src/gui/styles/scrollbar.rs index 8dc3a09a..58605df0 100644 --- a/src/gui/styles/scrollbar.rs +++ b/src/gui/styles/scrollbar.rs @@ -33,7 +33,7 @@ impl iced::widget::scrollable::StyleSheet for StyleTuple { } } - fn hovered(&self, _: &Self::Style, _is_mouse_over_scrollbar: bool) -> Scrollbar { + fn hovered(&self, _: &Self::Style, is_mouse_over_scrollbar: bool) -> Scrollbar { let colors = get_colors(self.0); Scrollbar { background: Some(Background::Color(colors.round_borders)), @@ -43,7 +43,11 @@ impl iced::widget::scrollable::StyleSheet for StyleTuple { scroller: Scroller { color: colors.secondary, border_radius: BORDER_ROUNDED_RADIUS, - border_width: BORDER_WIDTH * 1.5, + border_width: if is_mouse_over_scrollbar { + BORDER_WIDTH * 1.25 + } else { + BORDER_WIDTH * 1.75 + }, border_color: Color::TRANSPARENT, }, } diff --git a/src/gui/styles/slider.rs b/src/gui/styles/slider.rs index 1025e979..5bffcf80 100644 --- a/src/gui/styles/slider.rs +++ b/src/gui/styles/slider.rs @@ -6,6 +6,7 @@ use iced_native::widget::vertical_slider::HandleShape; use crate::get_colors; use crate::gui::styles::style_constants::BORDER_WIDTH; +use crate::gui::styles::types::palette::mix_colors; use crate::gui::styles::types::style_tuple::StyleTuple; impl From for iced::theme::Slider { @@ -25,7 +26,7 @@ impl iced::widget::slider::StyleSheet for StyleTuple { width: 3.0, }, handle: Handle { - shape: HandleShape::Circle { radius: 7.0 }, + shape: HandleShape::Circle { radius: 5.0 }, color: colors.primary, border_width: BORDER_WIDTH, border_color: colors.secondary, @@ -41,8 +42,8 @@ impl iced::widget::slider::StyleSheet for StyleTuple { width: 3.0, }, handle: Handle { - shape: HandleShape::Circle { radius: 7.0 }, - color: colors.secondary, + shape: HandleShape::Circle { radius: 8.0 }, + color: mix_colors(colors.primary, colors.buttons), border_width: BORDER_WIDTH, border_color: colors.secondary, }, @@ -57,8 +58,8 @@ impl iced::widget::slider::StyleSheet for StyleTuple { width: 3.0, }, handle: Handle { - shape: HandleShape::Circle { radius: 7.0 }, - color: colors.secondary, + shape: HandleShape::Circle { radius: 8.0 }, + color: mix_colors(colors.primary, colors.buttons), border_width: BORDER_WIDTH, border_color: colors.secondary, },