chalk is a Python library for coloring text in terminal. Only a day or two ago, Painter is another library just released for same purpose.

Here is a couple of examples. First one is the basic usage:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQoVwdJ6BHGOU3gT4P1hKd7wUgQO5Zp3bXKf_bBVAsCM_YCjfKh54txZzXyhJatn55RWl2Ueia89thDzEC_9lxfZJgIdjyh576iw45mNQlJ9p0pkte65ZBHZuu8PpIFCOOJaBnvs-iDOY/s800/example-module.png

import chalk

chalk.blue("Hello world!!")
chalk.yellow("Listen to me!!!")
chalk.red("ERROR", pipe=chalk.stderr)
chalk.magenta('This is pretty cool', opts='bold')
chalk.cyan('...more stuff', opts=('bold', 'underscore'))

Second example shows how it can work with the standard logging module:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4mVAWUSsHfVAD_k2RlxGLVjtfDO4xB75c7ArGOjpK9Z2vLxfaMsF2jB5fgO7Y7Zh4T5bn9xINlrB0kf8Pw99817eftzkj-Xx-AngAfEhmTG0_g6obBM8DdQOZpbJuMj8lx9-QU2UErUQ/s800/example-log.png

import logging
from chalk import log

logger = logging.getLogger(__name__)

handler = log.ChalkHandler()
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)

logger.error('Error!!!!')
logger.warning('Warning!!!!')
logger.info('Info!!!!')
logger.debug('Debug!!!!')

chalk is written by Anthony Almarza under the MIT License, currently version 0.0.3 (2014-05-02), works for both Python 2 and 3.