2

I want to change the color of a text . Of course I don't want to make a GUI for my program. I want to do that just for Terminal . As an example please change this :

print("Hello SO !")
Irteam
  • 31
  • 1
  • 1
  • 2
  • 1
    [This question](http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python) might help you. –  Sep 27 '13 at 07:33
  • You can use the [`colorama`](https://pypi.python.org/pypi/colorama) module. – martineau Sep 27 '13 at 08:55

2 Answers2

4
  1. Install pip install termcolor
  2. Run this code:

    from termcolor import colored
    print(colored("Hello world in red style!", 'red'))
    
  3. use windows powershell or unix shell

Community
  • 1
  • 1
itdxer
  • 1,236
  • 1
  • 12
  • 40
  • 1
    this code not working on windows machine, it printed **←[31mHello world in red style!←[0m** – Patrick Aug 01 '14 at 14:16
0

You could use ANSI color codes. Unfortunately, I believe this only works on Linux-based systems.

Vladimir Putin
  • 661
  • 1
  • 8
  • 18