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

Provides cross-platform text coloring for consoles, useful functions and a nestable color format syntax.

colorise has been tested with Python 2.6, 2.7, 3.2 and 3.3.

Installation:

You can install via pip:

pip install colorise

Alternatively, if you downloaded the source files, just run the following command from the download directory:

python setup.py install

Usage:

There are a number of ways to color the foreground- and background colors of the output to the console. You can find additional examples in the /examples folder.

You can directly set the color:

You can print some text in a predefined color

colorise has a special color format syntax that allows for nested expressions as well:

There are a few useful tools as well:

colorise.highlight behaves like colorise.formatbyindex, but will write the output instead of returning a string:

If you have a < or > in your string, you can escape it with a backslash \. The backslash is automatically removed. Colons, escaped or not, : are ignored if they appear as text.

Implementation notes

On Linux and Unix there are no ‘dark’ themed backgrounds (perhaps “bolded” colors which do not truly represnt darkened colors), so calling

>>> colorise.cprint("Isn't this wrong?", bg='darkred')

will just set the background color to red.

Due to the many different termnial/console types, it is virtually impossible to correctly map color names to their actual colors. You may see variations (like ‘yellow’ showing up as brownish, e.g. on my Xubuntu box) or other discrepancies. colorise assumes the following available colors:

  • Black
  • Red
  • Green
  • Yellow
  • Blue
  • Magenta
  • Cyan
  • White

It is therefore best to stick to colors which are more likely to be present and correct, like ‘red’, ‘blue’ and ‘green’.

Release History

Release History

0.1.4

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

0.1.3

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

0.1.0

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

0.0.0

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
colorise-0.1.4.zip (19.1 kB) Copy SHA256 Checksum SHA256 Source Jun 11, 2014

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