Textualize / rich-cli

Rich-cli is a command line toolbox for fancy output in the terminal
https://www.textualize.io
MIT License
3.04k stars 75 forks source link

Some themes not working on the Windows Terminal #17

Closed rodrigogiraoserrao closed 2 years ago

rodrigogiraoserrao commented 2 years ago

Some --themes are not working on my Windows Terminal (using Windows 11) although they seem to work on WSL on the same machine.

Some of the themes not working include gruvbox-light, dracula, and friendly_grayscale (all taken from the pygments documentation here).

Below you can find a screenshot showing the Windows terminal on the left and WSL on the right, both running rich-cli 1.3.0:

  1. I ran rich without specifying a theme;
  2. I ran rich with --theme dracula and the Windows terminal renders it with the same styling as if I had invented a random theme name;
  3. I ran rich with another theme that both terminals seem to recognise, although the colours don't match 100% (which is fine).

_rich_cli_not_working

Running python -m rich.palette gives this output:

_rich_cli_not_working_palette

willmcgugan commented 2 years ago

So it looks like WSL only supports 256 colors. Some themes use full RGB colors, and they may not look quite as intended, but generally "good enough".

The puzzling one is the dracula theme on the left. That's clearly the "default" theme. Do you perhaps have an older version of pygments? If you update pygments, does anything change?

rodrigogiraoserrao commented 2 years ago

That was it. I had pygments 2.8.1, and python -m pip install pygments --upgrade updated it to 2.11.2. Now, all themes seem to be working fine. Was this my fault, or "should" rich-cli pin a higher version of pygments?

willmcgugan commented 2 years ago

Was this my fault, or "should" rich-cli pin a higher version of pygments?

Maybe it should. But that increases the odds of a version conflict.

If you install it via pipx you get a unique environment and you'll get the latest pygments.

I think I might wait until there are a few more installation methods before I decide. At least now if anyone is missing Dracula, I'll know what to tell them.

rodrigogiraoserrao commented 2 years ago

Maybe it should. But that increases the odds of a version conflict.

Understood. As far as I'm concerned, this issue can be closed. Thanks.