jquast / blessed

Blessed is an easy, practical library for making python terminal apps
http://pypi.python.org/pypi/blessed
MIT License
1.2k stars 72 forks source link

PowerShell and cmd Prompt Not Showing Colors #194

Closed MrHemlock closed 3 years ago

MrHemlock commented 3 years ago

Having a rather odd issue with the library. For some reason I'm unable to see all the colors that blessed has to offer. I ran the example code x11_colorpicker.py and only about half a dozen colors properly displayed. Is there something I'm missing?

avylove commented 3 years ago

What version of Windows are you running? The number of colors is handled by the Jinxed library on Windows. If you're running an older version of Windows, only 16 colors is supported. Blessed will downscale colors beyond that range to the supported range.

MrHemlock commented 3 years ago

Windows 10 Professional 64-bit

avylove commented 3 years ago

Can you run this and let me know what you get?

>>> import platform
>>> platform.version()

>>> import os
>>> os.environ.get('ANSICON')
MrHemlock commented 3 years ago

platform.version() gave me 10.0.19041 os.environ.get('ANSICON') gave me no output.

avylove commented 3 years ago

Then you should be able to support 16-bit color. I can't reproduce your issue with Python 3.9 on Windows 10.0.19041.

Can you try the following?

>>> import blessed
>>> term = blessed.Terminal()
>>> term._kind
'vtwin10'
>>> term.errors
['parameters: kind=None, stream=None, force_styling=False']
>>> term.does_styling
True
>>> term.number_of_colors
16777216
MrHemlock commented 3 years ago

Got the exact same output as you did:

In [1]: import blessed

In [2]: term = blessed. Terminal()

In [3]: term
Out[3]: <blessed.win_terminal.Terminal at 0x1dc27d4dac0>

In [4]: term._kind
Out[4]: 'vtwin10'

In [5]: term.errors
Out[5]: ['parameters: kind=None, stream=None, force_styling=False']

In [6]: term.does_styling
Out[6]: True

In [7]: term.number_of_colors
Out[7]: 16777216

Here's some example screenshots. Some colors work, a majority don't. (not sure if these help, but I figured it couldn't hurt to show you.) EDIT: Also just tried the plasma.py example. No color, just the cursor zipping its way down the window.

2021-02-22 15_47_07-Window 2021-02-22 15_47_50-Window 2021-02-22 15_48_21-Window

avylove commented 3 years ago

It seems you are using ipython rather than python to run the commands. I get the same results on Windows with ipython. While it's not the intended interpreter, it does work on Linux. That said, IPython does a lot of its own terminal manipulation and it may be difficult to determine what it's doing. If you need IPython to work in this way, it may be worth filing a bug with them.

MrHemlock commented 3 years ago

Fair enough. The only reason I was attempting to use ipython was because that was what the example gif used in the introduction section on the README.rst. I'll keep that in mind if I end up trying to futz around with this in a terminal in the future. I appreciate you taking the time to help me out on this!