Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Terminal colors made easy!

Project Description

Python Easy Color

Color output in python2/3 made easy!


Make python color ouput easy in UNIX terminals that support ANSI sequences.


pip install easycolor


Check the documentation at: ( also available at: (

Source Code

Check at github: (


Copyright George T. Gougoudis 2016. BSD 3-Clause license; see LICENSE file.

Basic usage

To wrap text, the wrap function must be imported.

from import wrap as _w

The text is then wrapped as easy as

# wrap text, appends a style-reset
print(_w('yellow on red', fg='yellow', bg='red'))
print('normal text')

To compile a style, the make_style function is used:

from import make_style, RESET


# define some styles
black_on_white = make_style(fg='black', bg='white')
# we have to reset the background here
red_bold = make_style(fg='red', bg='reset', opt='bold')
# An options reset is only possible with a total reset
# we can however negate an option to remove it('!option').
green_bold_underline = make_style(fg='green', opt=('!bold', 'underline'))

print(black_on_white + 'Black on white' + red_bold + 'Red bold' +
      green_bold_underline + 'Green not bold underline' + RESET)

Note: For advanced formatting use the easycolor.parser module.

Advanced usage

First obtain an instance

from easycolor.parser import ColorParser
parser = ColorParser()

Then for printing

cprint = parser.cprint
# Add rainbow colors!
# complex foreground - background
cprint("""<f:red,b:yellow>red on yellow</b>just red<b:black>red on black!"""
       """<f:green>green on black</f>again red on black</f,b>normal""")

Parse a format string for a colored logger, for later use

INFO = parser.parse("[<f:cyan>INFO</f>] <o:bold>{}")
print(INFO.format('Some info..'))

Release History

This version
History Node


Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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