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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file colorcodes-elunico-1.0.0.tar.gz.

File metadata

  • Download URL: colorcodes-elunico-1.0.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for colorcodes-elunico-1.0.0.tar.gz
Algorithm Hash digest
SHA256 87693e41b07eef01f70a44a1a0f8f89a022f57ad83981104a8e24a50524b0cfe
MD5 e5e0e52c5dcfa00edb3787707cf12a45
BLAKE2b-256 7ce6f0a77d6b4ce3f4ec18be4b4428b6e60d9ba843e5602cd13031a9026d7145

See more details on using hashes here.

File details

Details for the file colorcodes_elunico-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for colorcodes_elunico-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1674e78c1a89cbc9427b80ea9a7610395bc765b7707a20d82bb5c819f5844ba4
MD5 c0f4c2178cf993d0aa6b72795c3be283
BLAKE2b-256 a5560466fb8198be679cf6e578ff94d4d333d4cc979dad98bd81489fd64fcf01

See more details on using hashes here.

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