-
Notifications
You must be signed in to change notification settings - Fork 5
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
Bug: onyo cat
syntax highlighting is unreadable in some terminals
#706
Comments
I like the ideas for the flag and the option, it makes a lot of sense to me. I have no strong oppinions about default colors. Of course it makes sense to select something that works for most configurations, i.e. a strong contrast between writing and background, and there are still discussions in the chat going on about transperancy, but in the end... This might be a good oportunity for us to test in the group to usage of local config files. |
onyo cat
syntax highlighting is unreadable in some terminalsonyo cat
syntax highlighting is unreadable in some terminals
I think the default should actually be something that does not use colors, but only bold, underlined, italic .. attributes. We need a pretty generic config mechanism for this and figure out how to also apply that to other outputs including help. |
I agree.
Oof. Good point. That one... will be difficult and may require its own issue. @j-leo you're the one running a terminal with a bright background. How is the legibility of the text (and colorized text) in Looking at the highlighting in a complex one ( |
|
I looked into this, and have this "working", except... it fails in piping. So, short form is that the The problem is that Rich's
I'm not sure which is the actual issue yet. I'm looking into it. The current workaround is to use pygments directly (which is what Rich is using):
And then replace
with
This works wonderfully, except it doesn't get to use Rich's nice auto-detection of pipes, etc, so all those situations break. I did find an upstream bug that is exactly our problem. It doesn't really dig into the underlying problem though. I will look into this problem further, and either comment upstream, or open a PR. |
Now that I look closer, though Rich is using |
The beautiful thing about the It's unclear to me if I can tickle |
Hah. I discovered Sigh. So, that's one problem resolved. Now the issue is that the color does not invert as needed. |
The issue is not so much that it doesn't invert, but rather that the color is set at all. The I have isolated the line that hardcodes this: https://github.com/Textualize/rich/blob/43d3b04725ab9731727fb1126e35980c62f32377/rich/syntax.py#L165 color="#" + color if color else "#000000", IMO, this default should either be |
I have opened a PR upstream: Textualize/rich#3582 |
Depending on the terminal color scheme, the syntax highlighting can be either wonderful, or entirely illegible.
The color theme should be configurable by the user. Rich.Syntax uses Pygments Styles.
I propose adding a flag and config option:
And the config:
The current default (inherited from Rich) is
monokai
.It may be necessary also to look at
Rich.Syntax
'sbackground_color
:In addition to available styles, we should allow
'none'
(or'disable'
) to turn off syntax highlighting incat
.To list available styles:
Open Question:
The text was updated successfully, but these errors were encountered: