console colouring for python
Note: This package has been built automatically by zero2pypi. If possible, you should use the zero-install feed instead: http://gfxmonk.net/dist/0install/python-termstyle.xml
termstyle is a simple python library for adding coloured output to terminal (console) programs. The definitions come from ECMA-048, the “Control Functions for Coded Character Sets” standard.
I thoroughly recommend using the zero-install feed (see the project homepage) to manage your dependencies if at all possible. zero-install provides a much better system than pip or easy_install, and works with absolutely any language and allows decentralised package management that requires no special privileges to install.
from termstyle import * print "%s:%s" % (red('Hey'), green('how are you?')) print blue('How ', bold('you'), ' doin?')
or, you can use a colour just as a string:
print "%sBlue!%s" % (blue, reset)
reset or default (no colour / style)
black red green yellow blue magenta cyan white
bg_black bg_red bg_green bg_yellow bg_blue bg_magenta bg_cyan bg_white bg_default
In terminals supporting transparency bg_default is often used to set the background to transparent .
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.