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.1.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.1.tar.gz.
File metadata
- Download URL: tinycolors-0.6.1.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 |
67bc7b8f120fb3f126ad92f536d0becb339775662e9b1c3bb8edff03a37991cd
|
|
| MD5 |
d87122ba6e832c2dcfa7127ad8b84f97
|
|
| BLAKE2b-256 |
4c58fd7e00c364fce3a20b2372ac472487eea4b3e0fea1cd41c27a84613339ab
|
File details
Details for the file tinycolors-0.6.1-py3-none-any.whl.
File metadata
- Download URL: tinycolors-0.6.1-py3-none-any.whl
- Upload date:
- Size: 15.1 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 |
d94d6d041ffa63b19d9e6a98f6174e2714ad6c9a6a316a873f69458a0f6d9ea0
|
|
| MD5 |
cf9da81788cdf833b51ff63067ddeb3c
|
|
| BLAKE2b-256 |
0a224080a54f5f30f341c675a0e07ee43cae50a8a628136630f5144be7fe2b9f
|