Color terminal text with ANSI Styles and Colors.
python ./setup.py build
pip install .
from colorful import Color
...
c = Color("This is some text")
c.bold() #set bold style
c.green() #set green text
print(c) #output
print(Color("This is some text").green()) # Create and output in one line.
c = Color("This is a chain example")
c.bold().green().on_magenta() #green text, magenta background
print(c) #output
print(Color("This is some text").bold().yellow()) # Create, chain and output in one line.
obj1 = Color("This is some text").yellow().invert()
obj2 = Color("This is some more text").magenta().blink()
print(obj1+obj2)
obj = Color("This is some text").yellow().invert()
string = "This is some more text"
combo = obj + string
print(combo)
- black()
- red()
- green()
- yellow()
- blue()
- magenta()
- cyan()
- white()
- bright_black()
- bright_red()
- bright_green()
- bright_yellow()
- bright_blue()
- bright_magenta()
- bright_cyan()
- bright_white()
- reset()
- bold()
- dim()
- blink()
- italic()
- underline()
- invert()
- hide()
- strike() --NOT SUPPORTED IN SOME TERMINALS--
- on_black()
- on_red()
- on_green()
- on_yellow()
- on_blue()
- on_magenta()
- on_cyan()
- on_white()