5

I can print test1 in green and test2 in red in ipython :

print ('\033[92m' + "test1")
print ('\033[91m' + "test2")

But gives me the following error printed in white in the terminal :

[92mtest1
[91mtest2
G F
  • 321
  • 1
  • 5
  • 12

1 Answers1

7

Windows terminal doesn't handle ansi coding for coloring text like other (vt100 compatible) terminals. If you want to be able to color your output in windows your best bet is likely going to be something like colorama, Ansicon or some other external program to handle colorizing output to the windows terminal.

Jamie Crosby
  • 152
  • 7
  • thanks it works with Colorama – G F Jan 25 '18 at 16:05
  • 5
    Except the Windows 10 console does support virtual terminal sequences. It can be enabled by default for all console windows by setting a "VirtualTerminalLevel" REG_DWORD with a value of 1 in the registry key "HKCU\Console". – Eryk Sun Jan 25 '18 at 20:23