A minimal Python package for printing colored text in the terminal with five basic colors
Project description
khx_color_text
A minimal Python package for printing colored text in the terminal with exactly five basic colors.
Installation
pip install khx_color_text
Usage
Python API
from khx_color_text import cprint
# Print text in different colors
cprint("Hello World!", "red")
cprint("Success message", "green")
cprint("Information", "blue")
cprint("Warning", "yellow")
cprint("Highlight", "cyan")
Command Line Interface
# Basic usage
khx-ct "Hello World!" --color red
# Default color is cyan
khx-ct "Hello World!"
# All available colors
khx-ct "Red text" --color red
khx-ct "Green text" --color green
khx-ct "Blue text" --color blue
khx-ct "Yellow text" --color yellow
khx-ct "Cyan text" --color cyan
Examples
Red
cprint("Hello from khx_color_text in red!", "red")
Green
cprint("Hello from khx_color_text in green!", "green")
Blue
cprint("Hello from khx_color_text in blue!", "blue")
Yellow
cprint("Hello from khx_color_text in yellow!", "yellow")
Cyan
cprint("Hello from khx_color_text in cyan!", "cyan")
How Previews Are Generated
The SVG previews above are generated deterministically using the scripts/gen_assets.py script. This script uses Rich Console with a fixed width (60 characters) to capture the colored output and export it as SVG files. The previews are automatically regenerated on each push to the main branch via GitHub Actions.
To regenerate the previews locally:
pip install -e .[docs]
python scripts/gen_assets.py
Supported Colors
The package supports exactly five colors:
redgreenblueyellowcyan
Cross-Platform Support
This package uses colorama to ensure colored output works correctly on Windows, macOS, and Linux terminals.
License
MIT License - see LICENSE file for details.
Author
ABUELTAYEF Khader
- Email: abueltayef.khader@gmail.com
- GitHub Personal: @Khader20
- GitHub Organization: @Khader-X
- PyPI: Khader20
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file khx_color_text-0.1.0.tar.gz.
File metadata
- Download URL: khx_color_text-0.1.0.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cb566a2732afdc0ec5df39ac984731f794f011a0eb1b72b8ad4b15950705dda
|
|
| MD5 |
87ee22ca8d378ead676c6f479c869af8
|
|
| BLAKE2b-256 |
569c52aeb225f7e3386d148753985bb7cb9f6acb56aaff520f692f216f4f8606
|
File details
Details for the file khx_color_text-0.1.0-py3-none-any.whl.
File metadata
- Download URL: khx_color_text-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e3d4d5d49674b9346cdfdcbbdaf7740287512ee91da7018c20dee264fa83746
|
|
| MD5 |
618e80434aba7f61ba184bee6e5544a5
|
|
| BLAKE2b-256 |
d8f78d9f7fb7b389e375b45348fb3839929b2b6004551bfde49f1e9e45580eb8
|