Clint, Command Line Library for Python
nicosphere.net
nicosphere.net
Shouldn't color should really be a parameter - unless the console only accepts a fixed set of colors?
I like the rest of it - using a 'with' block for indentation is clever.
Ruby has highline and colored, and perhaps some more too.
printred = colored.print_function("red")
printred("This prints in red") print_function = lambda c: getattr(colored, c)
printred = colored.print_function("red")
printred("This prints in red")print colored('Hello, World!', 'red')
print ColoredString("red", "some text") from clint.textui.color import red, blue, green
print "{0}, {1}, and {2}".format(red('red'), blue('blue'), green('green'))