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.6.5.tar.gz
(15.2 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.6.5.tar.gz.
File metadata
- Download URL: tinycolors-0.6.5.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0056207418730d05a9c9b485ef9860a0768574dfe197ad11901df3ec471fd95a
|
|
| MD5 |
8095af3b94bceafdc81b034b4eb766bd
|
|
| BLAKE2b-256 |
ca0b3cecc154c3cab852984e1590f5a14484311a5ea8b3818aa20a3f2c9f0ece
|
File details
Details for the file tinycolors-0.6.5-py3-none-any.whl.
File metadata
- Download URL: tinycolors-0.6.5-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c812d987df35c5fb57fffdc3fd2a8cfaed5560f65bc9e5c82c76981f1ed78c40
|
|
| MD5 |
4aa33ba537f2bb165d9c542a45b3abdb
|
|
| BLAKE2b-256 |
1de07a51c70e87eedd8a5751b50de5d901b368b61460b1e444f48c75d5b277d6
|