textual
textual copied to clipboard
Allow more easily customisable scrollbar glyphs
- [x] Docstrings on all new or modified functions / classes
- [x] Updated documentation (not needed I think?)
- [x] Updated CHANGELOG.md (not needed, I don't think it warrants a changelog?)
Closes #4500
This allows a user to easily customise scrollbar display. For example, when using the Consolas font, scrollbars display poorly:
By reducing the characters to those supported, the display is more consistent:
ScrollBarRender._vertical_bars = ["▄", "█", " "]
By using some lightly shaded characters, the scrollbars gain some flair:
ScrollBarRender._vertical_bars = ["░", "▒", "▓", " "]
The blank glyph can also be replaced:
ScrollBarRender._vertical_bars = ["░", "▓", " "]
ScrollBarRender._blank_glyph = "▒"
This is easier than replacing the entire ScrollBarRender.render_bar function.
I try to avoid Windows if I can help it, but unlike classic conhost I think the Windows Terminal has font fallback. That's not any criticism of this PR and you're probably already aware, but just thought I should mention it as there's likely some other glyphs used in Textual which are missing in Consolas.
Yes, I personally use Windows Terminal with a nerd font, so textual apps look great on my machine.
However, I often give TUI tools to people without python, so I compile them to an .exe with pyinstaller. Double clicking that will always open in cmd.exe, and the default font is Consolas.