Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more easily customisable scrollbar glyphs #4505

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mon
Copy link

@mon mon commented May 11, 2024

  • Docstrings on all new or modified functions / classes
  • Updated documentation (not needed I think?)
  • 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:
cmd_NfNfGUSQfX

By reducing the characters to those supported, the display is more consistent:

ScrollBarRender._vertical_bars = ["▄", "█", " "]

cmd_4MxcLegZxq

By using some lightly shaded characters, the scrollbars gain some flair:

ScrollBarRender._vertical_bars = ["░", "▒", "▓", " "]

cmd_1HZHPAXOts

The blank glyph can also be replaced:

ScrollBarRender._vertical_bars = ["░", "▓", " "]
ScrollBarRender._blank_glyph = "▒"

cmd_HieEhLsuqH

This is easier than replacing the entire ScrollBarRender.render_bar function.

@TomJGooding
Copy link
Contributor

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.

@mon
Copy link
Author

mon commented May 15, 2024

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.

src/textual/scrollbar.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to customise scrollbar bar segments
3 participants