howdoi: Cant Print out the colors in Powershell Or CMD Terminal
What happened:
howdoi cant print out colors in Powershell Or CMD terminal in color mode.
> howdoi -c how to extend a list in python --explain
INFO: Version: 2.0.19
INFO: Fetching answers for query: how to extend a list in python
INFO: Using cached links
INFO: Links from stackoverflow.com found on google: 1
INFO: URL: https://stackoverflow.com/questions/252703/what-is-the-difference-between-pythons-list-methods-append-and-extend
INFO: Answers requested: 1, Starting at position: 1
INFO: Total answers returned: 1
>>> x = [[94m1[39;49;00m, [94m2[39;49;00m, [94m3[39;49;00m]
>>> x.append([[94m4[39;49;00m, [94m5[39;49;00m])
>>> [96mprint[39;49;00m(x)
[[94m1[39;49;00m, [94m2[39;49;00m, [94m3[39;49;00m, [[94m4[39;49;00m, [94m5[39;49;00m]]
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- Use `colorama` to support colorization in Powershell Fixes https://github.com/gleitz/howdoi/issues/445 — committed to gleitz/howdoi by gleitz 2 years ago
- Use `colorama` to support colorization in Powershell Fixes https://github.com/gleitz/howdoi/issues/445 — committed to gleitz/howdoi by gleitz 2 years ago
Ah I see, you use colorama together with rich and it monitors
stdout, rewriting the colors as necessary.@V2dha would you mind giving that a try on your branch and seeing if the Windows colors look correct? @SepehrRasouli can help test as well.
That’s interesting. I haven’t done too much testing with Windows and colorization. We use
pygmentsto do the highlighting currently.Would you mind checking out this branch and seeing if that works any better? It uses the
richlibrary and perhaps they have figured out how to work with Powershell.https://github.com/gleitz/howdoi/pull/443
Then run
python -m howdoi -c how to extend a list in python --explain. Here’s what I see: