diff --git a/src/textual/scrollbar.py b/src/textual/scrollbar.py index 2700419192..a105aa8370 100644 --- a/src/textual/scrollbar.py +++ b/src/textual/scrollbar.py @@ -70,6 +70,13 @@ def __rich_repr__(self) -> rich.repr.Result: class ScrollBarRender: + VERTICAL_BARS: ClassVar[list[str]] = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", " "] + """Glyphs used for vertical scrollbar ends, for smoother display.""" + HORIZONTAL_BARS: ClassVar[list[str]] = ["▉", "▊", "▋", "▌", "▍", "▎", "▏", " "] + """Glyphs used for horizontal scrollbar ends, for smoother display.""" + BLANK_GLYPH: ClassVar[str] = " " + """Glyph used for the main body of the scrollbar""" + def __init__( self, virtual_size: int = 100, @@ -99,9 +106,9 @@ def render_bar( bar_color: Color = Color.parse("bright_magenta"), ) -> Segments: if vertical: - bars = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", " "] + bars = cls.VERTICAL_BARS else: - bars = ["▉", "▊", "▋", "▌", "▍", "▎", "▏", " "] + bars = cls.HORIZONTAL_BARS back = back_color bar = bar_color @@ -112,7 +119,7 @@ def render_bar( _Segment = Segment _Style = Style - blank = " " * width_thickness + blank = cls.BLANK_GLYPH * width_thickness foreground_meta = {"@mouse.down": "grab"} if window_size and size and virtual_size and size != virtual_size: