Python Forum
Coloured text in the terminal works in Linux but not Windows - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Coloured text in the terminal works in Linux but not Windows (/thread-20712.html)



Coloured text in the terminal works in Linux but not Windows - Flexico - Aug-26-2019

I'm using the syntax "\033[31;40mRed\033[37;40m" for coloring text in the terminal, and it works perfectly on my Linux laptop, but when I installed Python on my Windows PC and tried running my code, the color syntax just printed as-is. Is there another module I have to install for it to work on Windows?


RE: Coloured text in the terminal works in Linux but not Windows - metulburr - Aug-26-2019

That ANSI escape sequences are going to work on terminals under linux, not Windows command prompt. I dont think the default windows prompt supports escape sequences, but i could be wrong. For windows, people usually use a library such as colorama.

You could also install either Cmder, ConEmu, ANSICON or Mintty (used by default in GitBash and Cygwin) to add coloring support to your Windows command console with escape sequences


RE: Coloured text in the terminal works in Linux but not Windows - Flexico - Aug-26-2019

Thanks for the info! I'll have to check those out.