Skip to main content

A minimal Python package for printing colored text in the terminal with five basic colors

Project description

khx_color_text

Python Version License: MIT CI Status

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")
Red example

Green

cprint("Hello from khx_color_text in green!", "green")
Green example

Blue

cprint("Hello from khx_color_text in blue!", "blue")
Blue example

Yellow

cprint("Hello from khx_color_text in yellow!", "yellow")
Yellow example

Cyan

cprint("Hello from khx_color_text in cyan!", "cyan")
Cyan example

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:

  • red
  • green
  • blue
  • yellow
  • cyan

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

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

khx_color_text-0.1.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

khx_color_text-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

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

Hashes for khx_color_text-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cb566a2732afdc0ec5df39ac984731f794f011a0eb1b72b8ad4b15950705dda
MD5 87ee22ca8d378ead676c6f479c869af8
BLAKE2b-256 569c52aeb225f7e3386d148753985bb7cb9f6acb56aaff520f692f216f4f8606

See more details on using hashes here.

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

Hashes for khx_color_text-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e3d4d5d49674b9346cdfdcbbdaf7740287512ee91da7018c20dee264fa83746
MD5 618e80434aba7f61ba184bee6e5544a5
BLAKE2b-256 d8f78d9f7fb7b389e375b45348fb3839929b2b6004551bfde49f1e9e45580eb8

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