Skip to main content

A flexible utiltity for printing out text in various colors and styles

Project description

Color Codes

colorcodes.py is a module that helps you print color formatted text.

You can do this in many ways

Inserting colors into strings

You can use string formatting and the ColorCode objects to print colored text

from colorcodes import blue
print("Hello, {}world".format(blue))

This is good for simple, permanent color changes.

You can also combine these with the + operator

from colorcodes import blue, bold, uline
print("Hello, {}world".format(blue + bold + uline))

If you do not need to intermingle color and style then you can use individual ColorCodes print() method

import colorcodes

colorcodes.magenta.print("This text is all magenta")

These can also be combined using the + operator

import colorcodes

(colorcodes.magenta + colorcodes.bold).print("This text is all magenta")

Finally, you can use the cfs (short for Color Format String) wrapper class to print colored values with format specifiers

      #normal  #red  #mag #black
print("Welcome {:+r} {:m}{:k}".format(cfs('to the'), cfs('Jungle'), cfs('!')))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colorcodes-elunico-1.0.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

colorcodes_elunico-1.0.0-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page