From 906fc6e2166ee822f31eb0666536906c4a5d4ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:49:06 +0000 Subject: [PATCH 1/4] Fix #1479. --- src/textual/scrollbar.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/textual/scrollbar.py b/src/textual/scrollbar.py index 917e36a69e..f9db9c71b0 100644 --- a/src/textual/scrollbar.py +++ b/src/textual/scrollbar.py @@ -225,14 +225,15 @@ def __rich_repr__(self) -> rich.repr.Result: def render(self) -> RenderableType: styles = self.parent.styles - background = ( - styles.scrollbar_background_hover - if self.mouse_over - else styles.scrollbar_background - ) - color = ( - styles.scrollbar_color_active if self.grabbed else styles.scrollbar_color - ) + if self.grabbed: + background = styles.scrollbar_background_active + color = styles.scrollbar_color_active + elif self.mouse_over: + background = styles.scrollbar_background_hover + color = styles.scrollbar_color_hover + else: + background = styles.scrollbar_background + color = styles.scrollbar_color color = background + color scrollbar_style = Style.from_color(color.rich_color, background.rich_color) return ScrollBarRender( From e717c3cfada7a9b67c9dd77c43032692ce3d2360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:51:43 +0000 Subject: [PATCH 2/4] Update changelog. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ee7b9a673..dac91e7071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +### Fixed + +- The styles `scrollbar-background-active` and `scrollbar-color-hover` are no longer ignored https://github.com/Textualize/textual/pull/1480 + ## [0.9.1] - 2022-12-30 ### Added From f2108f0475a84eb0e6b366e3f9e09367197844e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:01:12 +0000 Subject: [PATCH 3/4] Make CI happy. --- src/textual/_win_sleep.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/textual/_win_sleep.py b/src/textual/_win_sleep.py index 4d417a07e3..e90930afca 100644 --- a/src/textual/_win_sleep.py +++ b/src/textual/_win_sleep.py @@ -12,7 +12,6 @@ CREATE_WAITABLE_TIMER_HIGH_RESOLUTION = 0x00000002 - def sleep(sleep_for: float) -> None: """A replacement sleep for Windows. From fb9e803863ab468b7dfd6264068bf818fd9593cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Thu, 5 Jan 2023 16:22:51 +0000 Subject: [PATCH 4/4] Add default styles for scrollbar colors. --- src/textual/widget.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/textual/widget.py b/src/textual/widget.py index 389c3b996c..65ff0bc0d5 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -190,8 +190,10 @@ class Widget(DOMNode): Widget{ scrollbar-background: $panel-darken-1; scrollbar-background-hover: $panel-darken-2; + scrollbar-background-active: $panel-darken-3; scrollbar-color: $primary-lighten-1; scrollbar-color-active: $warning-darken-1; + scrollbar-color-hover: $primary-lighten-1; scrollbar-corner-color: $panel-darken-1; scrollbar-size-vertical: 2; scrollbar-size-horizontal: 1;