This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description


Provide efficient and useful functions to use colors, in a HTML-tag style.

Almost all ANSI Colors are defined with this tags-like style. This point is the main interest of this module, because many others define functions to print with some colors.

The reset tag is a special one to reinitialize all previously changed parameters.



You can choose one of the 8 basic ANSI colors: black, red, green, yellow, blue, magenta, cyan, white. The names beginning with a lower-script design foreground colors.

For example

ANSIColors.printc('<reset>this is default. <red>this is red<yellow> and yellow in foreground now<reset>').


You can choose one of the 8 basic ANSI colours: Black, Red, Green, Yellow, Blue, Magenta, Cyan, White. The names beginning with a upper-script design background colors.

For example

ANSIColors.printc('<Default>this is default. <Blue>this have a blue background<Black> and black in background now<reset>').

Other tags

The following tags are also available :

  • italic, Italic : to turn on and off the italic mode (not always supported),
  • b, B : to turn on and off the bold mode (not always supported),
  • u, U : to turn on and off the underline mode (not always supported),
  • neg, Neg : to turn on and off the reverse video mode,
  • blink, Blink : to turn on and off the blink mode (not always supported),
  • el : to erase the current line,
  • bell : to make the terminal’s bell ring (not always supported).


Some macros are also provided, like the tags <ERROR>, <INFO> or <WARNING>.

And also <warning> and <question>, which respectively gives a colored ! and ?.

Writing to a file

This is possible with the writec function. For example

import sys
ANSIColors.writec('<ERROR><u><red>The computer is going to explode!<reset>', fn=sys.stderr)
# sys.stderr.flush()
# this is useless : writec flush itself.

Auto detection

Of course, the colors are disabled if the output doesn’t support them (e.g. a file or a piped command).

It works perfectly on GNU/Linux (tested on Ubuntu, Arch-Linux, Debian, Fedora and Angstrom) and Windows (with OR without Cygwin), and have not be tested on MAC OS X (but it should be alright).

Other features

Others functions

This module provides also the xtitle function, to change the title of the terminal. It tries to use the command xtitle, and if not available, tries to use one ANSI Code to change the title.

This module provides a notify function to display a system notification (using notify-send on Debian-like, not working on Windows).

Script is also a script. You can have his description (or use it) directly with

python -m ANSIColors --help

For testing

It can be used to run some tests (with the –test option).

With GNU/Bash

It can be used to generate a GNU/Bash color profile (with the --generate --file options).

This sh file can be imported with $ . in any GNU/Bash scripts, or even in your ~/.bashrc file.

An up-to-date version of this complete color profile can be found on my webpage.


This module is licensed under the term of the GNU Public License, version 3 (GPLv3). See the file LICENSE for more details.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ANSIColors-balises-1.9.9.public.tar.gz (14.2 kB) Copy SHA256 Checksum SHA256 Source Mar 20, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting