Skip to content

Commit

Permalink
Merge pull request #1480 from Textualize/fix-1479
Browse files Browse the repository at this point in the history
Prevent scrollbar rules from being ignored
  • Loading branch information
willmcgugan authored Jan 6, 2023
2 parents 70bded0 + fb9e803 commit 85afdba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- `MouseScrollUp` and `MouseScrollDown` now inherit from `MouseEvent` and have attached modifier keys. https://github.com/Textualize/textual/pull/1458

### 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
Expand Down
17 changes: 9 additions & 8 deletions src/textual/scrollbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 85afdba

Please sign in to comment.