Skip to content

jaschon/colorful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

colorful

Color terminal text with ANSI Styles and Colors.

Install

python ./setup.py build
pip install .

Import

from colorful import Color
...

Simple Example 1

c = Color("This is some text")
c.bold() #set bold style
c.green() #set green text
print(c) #output

Simple Example 2

print(Color("This is some text").green()) # Create and output in one line.

Chain Example 1

c = Color("This is a chain example")
c.bold().green().on_magenta() #green text, magenta background
print(c) #output

Chain Example 2

print(Color("This is some text").bold().yellow()) # Create, chain and output in one line.

Add Example 1

obj1 = Color("This is some text").yellow().invert()
obj2 = Color("This is some more text").magenta().blink()
print(obj1+obj2)

Add Example 2

obj = Color("This is some text").yellow().invert()
string = "This is some more text"
combo = obj + string
print(combo)

FG Colors

  • black()
  • red()
  • green()
  • yellow()
  • blue()
  • magenta()
  • cyan()
  • white()

Bright FG Colors

  • bright_black()
  • bright_red()
  • bright_green()
  • bright_yellow()
  • bright_blue()
  • bright_magenta()
  • bright_cyan()
  • bright_white()

Styles

  • reset()
  • bold()
  • dim()
  • blink()
  • italic()
  • underline()
  • invert()
  • hide()
  • strike() --NOT SUPPORTED IN SOME TERMINALS--

BG Colors

  • on_black()
  • on_red()
  • on_green()
  • on_yellow()
  • on_blue()
  • on_magenta()
  • on_cyan()
  • on_white()

About

Color terminal text with ANSI Styles and Colors

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages