Color strings using ANSI escape codes. Uses "dithering" to attempt to match the specified RGB value as close as possible.
Project description
A package to color text with ANSI escape codes, but takes in an RGB value and uses dithering to try match it.
The colorize_text function accepts a string and a RGB tuple. It returns the colorized string. To see the package in use you can try the run_example function.
Example usage:
import colordithering
text = '''
███████████████████████████████████
██████████ Hello World! ███████████
███████████████████████████████████
'''
color = (255, 125, 0) # orange color
print(colordithering.colorize_text(text, color))
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
colordithering-0.6.tar.gz
(2.8 kB
view details)
File details
Details for the file colordithering-0.6.tar.gz.
File metadata
- Download URL: colordithering-0.6.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a0192e07bae2df3d00f852d9958771f565a6b51d1ab890e15bbf7724c21d3cd
|
|
| MD5 |
ffd7e71a7b1921a75255f915b5510411
|
|
| BLAKE2b-256 |
7cd84a2b144f0be24dbc95a323f3d42ab3fa4ffb21d9442e17ee3c9cf4574ad9
|