File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,8 @@ def render(self) -> RenderableType:
286
286
else :
287
287
background = styles .scrollbar_background
288
288
color = styles .scrollbar_color
289
+ base_background , _ = self .parent ._opacity_background_colors
290
+ background = base_background + background
289
291
color = background + color
290
292
scrollbar_style = Style .from_color (color .rich_color , background .rich_color )
291
293
if self .screen .styles .scrollbar_color .a == 0 :
Original file line number Diff line number Diff line change @@ -3251,3 +3251,30 @@ async def run_before(pilot: Pilot) -> None:
3251
3251
terminal_size = (175 , 50 ),
3252
3252
run_before = run_before ,
3253
3253
)
3254
+
3255
+
3256
+ def test_scrollbar_background_with_opacity (snap_compare ):
3257
+ """Regression test for https://github.com/Textualize/textual/issues/5458
3258
+ The scrollbar background should match the background of the widget."""
3259
+
3260
+ class ScrollbarOpacityApp (App ):
3261
+ CSS = """
3262
+ Screen {
3263
+ align: center middle;
3264
+ }
3265
+
3266
+ VerticalScroll {
3267
+ width: 50%;
3268
+ height: 50%;
3269
+ background: blue 10%;
3270
+ scrollbar-background: blue 10%;
3271
+ scrollbar-color: cyan;
3272
+ scrollbar-size-vertical: 10;
3273
+ }
3274
+ """
3275
+
3276
+ def compose (self ) -> ComposeResult :
3277
+ with VerticalScroll ():
3278
+ yield Static ("\n " .join (f"This is some text { n } " for n in range (100 )))
3279
+
3280
+ assert snap_compare (ScrollbarOpacityApp ())
You can’t perform that action at this time.
0 commit comments