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 ColorCode
s 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87693e41b07eef01f70a44a1a0f8f89a022f57ad83981104a8e24a50524b0cfe |
|
MD5 | e5e0e52c5dcfa00edb3787707cf12a45 |
|
BLAKE2b-256 | 7ce6f0a77d6b4ce3f4ec18be4b4428b6e60d9ba843e5602cd13031a9026d7145 |
File details
Details for the file colorcodes_elunico-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: colorcodes_elunico-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1674e78c1a89cbc9427b80ea9a7610395bc765b7707a20d82bb5c819f5844ba4 |
|
MD5 | c0f4c2178cf993d0aa6b72795c3be283 |
|
BLAKE2b-256 | a5560466fb8198be679cf6e578ff94d4d333d4cc979dad98bd81489fd64fcf01 |