Skip to content
ANSI terminal tool for python, colored shell and other handy fancy features
Python Makefile
Latest commit 7bc782e Dec 13, 2015 @gabrielfalcao fixing ci

couleur - ANSI terminal tool for python, colored shell and other handy fancy features

Version 0.6.2

Couleur is a handy tool to play around with ANSI features in a unix terminal


user@machine:~$ sudo pip install git+git://


  • Single python file
  • 100% tested
  • comes with syntax sugar


file-like objects filter

stdout filter


import sys, couleur

print "#{bold}#{blue}#{on:black}This is#{normal} a test"

print "#{green}#{on:black}This is#{normal} a test"

dynamic methods

couleur has a syntax sugar that is semantically nice:

import couleur
sh = couleur.Shell(indent=4)

sh.bold_black_on_white('Nice highlight\n')
# prints '\033[47m\033[1m\033[30mNice highlight\033[0m'

# will increase a internal indentation factor in couleur.Shell instance'Just red\n')
# prints indented as well '    \033[32mJust Green\033[0m\n'


# will decrease that indentation factor (above)

# syntax sugar
sh.green_and_normal_and_blue('this will be printed in green| and |this in blue\n')
# see: '\033[32mthis will be printed in green\033[0m and \033[34mthis in blue\033[0m'

couleur can overwrite output, so that you can make things like printing progress bars, show percentage and so on:

import time
import couleur

shell = couleur.Shell(linebreak=True, bold=True)

for num in range(101):
    if num == 0:

    shell.yellow_and_red("Downloading file: |%d%%" % num, replace=True)

shell.white_and_green("Downloading file: |DONE!", replace=True)

Writing to other streams

Simply pass the output as first argument of the Shell

import couleur

with open('output.log', 'w') as output:
    shell = couleur.Shell(output, linebreak=True, bold=True)
    shell.white_and_green("done with | Some task")


With couleur you can mix modifiers and colors.

Available modifiers:

  • reset - resets from the current point to the end
  • bold - make text bold
  • blink - it may blink the text or make it slighly lighten, depending on the terminal
  • italic - make text italic
  • underline - add underline on text
  • inverse - invert colors
  • strikethrough - draws a line through the text
  • up - does the same than passing replace=True to the output function: carriage return and one line up

Available colors:

  • normal
  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

Example chaining modifiers:

import couleur

shell = couleur.Shell(linebreak=True)
shell.bold_italic_underline_green_on_black_and_italic_black_on_white("WOO| HOO")

free software

To contribute back with this project, all you need to do is write code, and test code that proofs its functionallity

cloning and running tests

You will need to install nose.

And run:

user@machine:~/Projects$ git clone git://
user@machine:~/Projects$ cd couleur
user@machine:~/Projects$ pip install -r requirements.txt
user@machine:~/Projects/couleur$ make


"couleur" stands for "color" in French, I like french, hence the name


Copyright (c) 2010-2013 Gabriel Falcão
Licensed under Apache License 2.0

Bitdeli Badge

Something went wrong with that request. Please try again.