A tiny, useful, and readable color library for fast colors
Project description
tinycolors
A tiny, useful, and readable color library for terminal output. Perfect for fast, simple ANSI color formatting in Python applications.
Installation
Install from PyPI:
pip install tinycolors
Quick Start
Basic Colorization
from tinycolors import colorize, cprint, cinput
# Colorize text with ANSI codes
red_text = colorize("Hello", color="red")
print(red_text)
# Print colored text directly
cprint("Success!", color="green")
cprint("Warning", color="yellow", style="bold")
# Input with colored prompt
name = cinput("Enter your name: ", color="blue")
Using Color Classes
from tinycolors import color, clib
# Basic colors
print(color.red + "Red text" + color.reset)
print(clib.green + "Green text" + clib.reset)
# Bright colors
print(color.bright.cyan + "Bright cyan" + color.reset)
# Background colors
print(color.bg.yellow + "Yellow background" + color.reset)
print(color.bg.bright.blue + "Bright blue background" + color.reset)
# Text styles
print(color.bold.red + "Bold red" + color.reset)
print(color.underline.blue + "Underlined blue" + color.reset)
print(color.italic.green + "Italic green" + color.reset)
Features
- Simple API: Easy-to-use functions for colorizing text
- ANSI Support: Full support for foreground and background colors
- Styles: Bold, dim, italic, underline, and more
- Tiny: Minimal overhead, no external dependencies
- Readable: Clean, intuitive class structure
- Fast: Pure Python with no dependencies
Available Colors
- Basic: black, red, green, yellow, blue, magenta, cyan, white
- Bright variants: bright black, bright red, bright green, bright yellow, bright blue, bright magenta, bright cyan, bright white
- Background colors available for all variants
Available Styles
- bold
- dim
- italic
- underline
- blink
- fast_blink
- inverse
- hidden
- strike
License
MIT License - See LICENSE file for details
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
tinycolors-0.5.0.tar.gz
(9.6 kB
view details)
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 tinycolors-0.5.0.tar.gz.
File metadata
- Download URL: tinycolors-0.5.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b22b8987d0e7cf95e0ccdad3857bf7fb0a0568ea37cd7abdde6dc892692d3c07
|
|
| MD5 |
e3c38dbaea1e4b8f5ab855765c6c9b14
|
|
| BLAKE2b-256 |
33cc36dcaae419500d46a0baa5de0299da2972947013ac9607f40f2a932adb22
|
File details
Details for the file tinycolors-0.5.0-py3-none-any.whl.
File metadata
- Download URL: tinycolors-0.5.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb3301f9174f9fa925d9988e0d3e3baddc75aff540a2ef2cf981111a5a355aba
|
|
| MD5 |
07072716fd353dc985c064a768d31e87
|
|
| BLAKE2b-256 |
c9c265030b9e8016fc5fe92d2ef671bf71eb5be62750c1a85df8704a942c0c63
|