Skip to main content

Replace the classic print function with several colorful functions

Project description

colorich

Python module - Use ANSI formatting to color output text by hexadecimal values, RGB values or by color specific name or decorate it

Use ANSI formatting to color output text by hexadecimal values, RGB values or by color specific name or decorate it.
The color names and values is inspired by https://www.w3schools.com/colors/colors_names.asp and https://github.com/jonathantneal

Functions:
expand - Expands the colors list, extra colors will be available if this function will be executed.

enrich - Return colored and decorated font for rgb values or for hex.
e.g. print(enrich("SeaGreen", (45, 140, 85)), "\n")
This example will color and print the text "SeaGreen" in the rgb color of (45, 140, 85) and start a new line.

dye - Only determine the foreground color of the font but can accept a dictionary of strings with their different colors values.
e.g. print(dye({"Periwinkle ": "periwinkle ", "Iceberg ": "Ice berg", "and ": "", "Forest green\n": "Forest green"}))
This example will color and print the text "Periwinkle Iceberg and Forest green" with several colors - every word will be colored with the color that is writen next to it, notice that the word "and" won't be colored because no color has been assigned to it.

printr - Prints the decorated colorized text that have sent as argument.
e.g. printr("Bold Turquoise on MediumSlateBlue", (64, 224, 208), "#7B68EE", "B", "\n")
This example will color, decorate and print the text "Bold Turquoise on MediumSlateBlue".
As it says, (64, 224, 208) is the text color, #7B68EE is the background color, "B" makes it bold, and \n will start a new line.

printd - Prints text that have sent as an argument in multiple colors.
e.g. printd("Red ; red", "Slate Blue ; slateBlue", "default color ", "and; Orange Red\n; OrangeRed")
This example will color and print the text "Red Slate Blue default color and; Orange Red" with several colors and eventualy will start a new line, notice that the delimeter sign ";" only apllyed as a delimeter to the last time of it's use.

show - prints all the colors and decorations name available and how it looks like.

Examples are in the bottom of the main file.

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

colorich-0.6.5.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

colorich-0.6.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file colorich-0.6.5.tar.gz.

File metadata

  • Download URL: colorich-0.6.5.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for colorich-0.6.5.tar.gz
Algorithm Hash digest
SHA256 18f8858624d618d916acac713e3c3744cd127273eca982fb1f076f3529aaf0fa
MD5 0c0a6ea2410a803eda2326e55cc9e6bd
BLAKE2b-256 a123a1037f62b1a90026fd06ff6679f09ee14143cbf1c64ac09868cfedd0173a

See more details on using hashes here.

File details

Details for the file colorich-0.6.5-py3-none-any.whl.

File metadata

  • Download URL: colorich-0.6.5-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for colorich-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b5bd142c47d20ca11fdb749c057e7a49c08f54ebcc222fafddd12cf8cf1f89c9
MD5 21dfb50a501ce631694411f2559e0973
BLAKE2b-256 06de97e7cc40af794e1ed025a80a7be67768925ac3b25c65490da0facb9d5075

See more details on using hashes here.

Supported by

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