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

[BUG] Need better detection of terminal color capabilities #1640

Closed
quadrillion opened this issue Nov 3, 2021 · 1 comment · Fixed by #1643
Closed

[BUG] Need better detection of terminal color capabilities #1640

quadrillion opened this issue Nov 3, 2021 · 1 comment · Fixed by #1643

Comments

@quadrillion
Copy link

Describe the bug
The terminal 'rxvt-unicode-256color' is not correctly identified as having 256 color support, because the code doesn't expect the base terminal name (rxvt-unicode) to have a hyphen (https://github.com/willmcgugan/rich/blob/master/rich/console.py#L773).

To Reproduce
Run urxvt from the rxvt-unicode-256 package.

Platform
Linux

Diagnose

$ python -m rich.diagnose
│ color_system = 'standard' │
│   is_interactive = True   │
│      is_terminal = True   │
│         no_color = False  |
$ python -m rich._windows
platform="Linux"
WindowsConsoleFeatures(vt=False, truecolor=False)
$ pip freeze | grep rich
rich==8.0.0

Recommendation
Query the terminal capabilities more directly, e.g.:

try:
    import curses
    curses.setupterm()
    num_colors = curses.tigetnum('colors')
except ModuleNotFoundError:
    pass
@github-actions
Copy link

github-actions bot commented Nov 5, 2021

Did I solve your problem?

Consider sponsoring the ongoing work on Rich and Textual.

Or buy me a coffee to say thanks.

Will McGugan

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 14, 2021
10.13.0

Added

Added json.dumps parameters to print_json Textualize/rich#1638

Fixed

Fixed an edge case bug when console module try to detect if they are in a tty at the end of a pytest run
Fixed a bug where logging handler raises an exception when running with pythonw (related to https://bugs.python.org/issue13807)
Fixed issue with TERM env vars that have more than one hyphen Textualize/rich#1640
Fixed missing new line after progress bar when terminal is not interactive Textualize/rich#1606
Fixed exception in IPython when disabling pprint with %pprint Textualize/rich#1646
Fixed issue where values longer than the console width produced invalid JSON Textualize/rich#1653
Fixes trailing comma when pretty printing dataclass with last field repr=False Textualize/rich#1599

Changed

Markdown codeblocks now word-wrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant