Welcome to ANSI Colors’s documentation!

Welcome to the documentation for ANSIColors-balises, a python 2 module to use ANSI colours in a terminal. This project is currently in version 1.9.9, release public. Last update of this doc was made 20/03/2013, 11h:41m:32s.

The main page of this little project is here on BitBucket.

The project is now hosted on Pypi, so a quick overview and the last release can be downloaded from PyPi.

See also

This is the main page of the doc for my project, but there are other resources on-line : This project is hosted on bitbucket, see here lbesson/ansi-colors. And it is also hosted here on my google site.

Installation

Dependencies

The project is entirely written in Python, version 2.7.3.
For more details about the Python language, see the official site.

Python 2.7.1 or higher is required.

Warning

But this script will not work with Python 3. A P3K compatible version is in progress !

How to install it ?

There is three different way :

Directly with pip

For instance, on GNU/Linux (or at least, with the most used Linux distribution), it can be installed with pip :

sudo pip install ANSIColors-balises

Download, extract, and use setup.py

Or you can also :

  1. download the file, from PyPi;

  2. extract it (with tar xzfv, or a graphical solution like File Roller);

  3. then go in the subdirectory (cd ANSIColors-balises-v2.0.something/);

  4. and finally with Python distutils setup tool:

    $ python setup.py install

    Or maybe with sudo rights, if the first try doesn’t work :

    $ sudo python setup.py install

Without installing it

Note that installation is not mandatory :
a third solution is to simply include the file ANSIColors.py, and embed it in your own projects. The project can be used without installing anything elsewhere.

Examples

The function printc

The main function of this module is printc. This function is like print("my string") or sys.stdout.write("my other string").

For instance, a quick description of super heroes’s costums can be done like this :

>>> printc("<reset><white>Batman's costum is <black>black<white>, Aquaman's costum is <blue>blue<white> and <green>green<white>, and Superman's costum is <red>red<white> and <blue>blue<white> ...")
Batman's costum is black, Aquaman's costum is blue and green, and Superman's costum is red and blue ...

Sorry, but it is hard to embed colours in a Sphinx generated web pages.

python -m ANSIColors --help

This show the help of the script, colored with the tools defined in the script :

The help message of the script.

python -m ANSIColors --test

This show a complete test of all balises defined in the module :

The canonical test of the script.

Documentation

And, a detailed description of every function is available on the documentation of the module ANSIColors.


Author:

The main author of this little project is Lilian Besson. I’m a French student at ÉNS de Cachan, currently I’m doing two MSc Mathematics and computer science (CS).

Feel free to contact me :
  1. either with this web page ~besson;
  2. or via my bitbucket account lbesson;
  3. or via Facebook naereencorp.lbesson;
  4. or via my Google Site site naereencorp;
  5. or via email here (remove the [] and change DOT to . and AT to @.

Indices and tables

Extract of the license (GPL v3)

For the complete license, see this file.

ANSIColors & ANSIColors-balises Copyright (C) 2012-13 Lilian Besson

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.