-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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] Cosmetic bug for __rich_repr__ repr-error #1326
Comments
Easy fix, will be in the next version. I wonder if I should offer alternative themes in Rich... |
Regarding additional themes: I found it easy enough to design my own themes - although I did have to dig up in the code to figure out some "repr" attribute names, like If I were you, I would just invite people to design their own themes, and provide links. One thing that I am not too fond of in the default theme for Rich when using Pygments for highlighting some code blocks is that, by default, Rich uses three different colours for True, False, and None for their "repr" while Pygments uses a single colour for all three. So, depending on how True/False/None are processed, they can show up in different colours in the terminal. For example, in your README, we can see |
Should be fixed in 10.5.0 I find the different highlighting of True / False / None helps when scanning a data dump. The color alone is enough to know what it is. I see your point that the styles don't match syntax highlighting. In tracebacks I forced the reprs to use the colors from the Pygments theme, because the difference is more jarring when the two are right next to each other. But for printing data structure I find the utility of the default theme to be worth it. |
10.5.0: Fixed Fixed Pandas objects not pretty printing Textualize/rich#1305 Fixed Textualize/rich#1256 Fixed typing with rich.repr.auto decorator Fixed repr error formatting Textualize/rich#1326 Added Added new_line_start argument to Console.print Added Segment.divide method Added Segment.split_cells method Added segment.SegmentLines class
Sorry for not replying sooner: as far as I can tell from my tests, it is fixed. Thanks! |
I'm sorry, I tried to come up with a simple example, but I could not create a simple example that generated a repr-error. I'm using Rich 10.4.0 and (ab)use
__rich_repr__
to create some translatable help.Basically, when a repr-error is generated, it contains an item enclosed in single quotes. This item can contain terms that are also enclosed in single quotes. If so, the result is not highlighted properly.
For info, here's what it looks like when I fix the error in my code, using my own colour scheme (I love this feature of Rich)
The text was updated successfully, but these errors were encountered: