🌈 Colorize commands output or STDIN using patterns.
Python Shell Roff
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.



last release pypi package continuous integration test coverage scrutinizer-ci.com score landscape.io score codeclimate.com score gitter chat

Easily colorize logs or commands output using patterns.

rainbow [ --COLOR=PATTERN ... | --conf CONF ] COMMAND


Using the command line

Prepend rainbow with --COLOR=PATTERN associations to your command, for example:

  • Tail some log file with lines containing ERROR in red:

    rainbow --red='ERROR.*' tailf /var/log/my.log
  • You can also pipe commands output into rainbow:

    tail -f /var/log/my.log | rainbow --red='.*ERROR.*'
  • Rainbow doesn't colorize if output is piped, to force color use env variables RAINBOW_ENABLE_STDOUT and/or RAINBOW_ENABLE_STDERR.

Using configs

Rainbow can load configuration for each command from files, which is the most convenient way to use it. When running rainbow command, rainbow will automatically look for a config named command.cfg in /etc/rainbow, ~/.rainbow, or builtin configs:

  • Colorize the diff command output using the builtin config:

    rainbow diff file1 file2
  • Start my custom command, using ~/.rainbow/mycommand.cfg:

    rainbow mycommand

The syntax for writing configs is straightforward, see the builtin configs for examples. See also the commands support table.


Using packages

System Installation instructions
Debian / Ubuntu rainbow repository
Fedora / CentOS / RHEL / Scientific Linux rainbow repository
OpenSUSE / SLE rainbow repository
Arch Linux AUR/rainbow / AUR/rainbow-git
pip / easy_install PyPI: rainbow

Building from sources

You can build from sources this way:

git clone git://github.com/nicoulaj/rainbow.git
cd rainbow
python setup.py build
sudo python setup.py install


Contributions are welcome, please see CONTRIBUTING.


This project is a fork of Linibou's colorex. It is is released under the terms of the GNU General Public License. See COPYING for details.