How do I print colored output with Python 3? - Stack Overflow
Here is a basic approach to set the terminal so that all following prints are rendered with a given color, attributes, or mode. Once an appropriate ANSI sequence is sent to the terminal, all following text is rendered that way. Thus if we want all text printed to this terminal in the future to be bright/bold red, print ESC[ followed by the codes for "bright" attribute (1) and red color (31 ...
As the author of Colorama, thanks for the mention @nbv4. I'll try and clarify a bit: Colorama aims to let Python programs print colored terminal text on all platforms, using the same ANSI codes as described in many other answers on this page. On Windows, Colorama strips these ANSI characters from stdout and converts them into equivalent win32 calls for colored text. On other platforms ...
How do I print colored text to the terminal? - Stack Overflow
I even tried to add attribute code to format with no success. This does not work and I can't find anywhere an example, where colors are added to printf, which has defined format as in my case.
I am trying to print a text in a red color in the terminal using echo command. How can I do that?
0 If you want to print to a terminal in color you have to use escape codes for the terminal you're using. For unix/linux systems you can use the curses module - or just use bash color codes directly as a part of your output string. There doesn't seem to be an easy way to do this in windows according to this question.