Skip to main content

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


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.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

tinycolors-0.5.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file tinycolors-0.5.1.1.tar.gz.

File metadata

  • Download URL: tinycolors-0.5.1.1.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

Hashes for tinycolors-0.5.1.1.tar.gz
Algorithm Hash digest
SHA256 bb3c9ffdad7cc6493af3c39079b90b35de4c64c8d39bac97c50bfa46fa8cf46d
MD5 a359209e7f01f9ff3ae1bd3979e37ad8
BLAKE2b-256 b06e3611108f6813c45780c913cd9a5b65f2c93af0f4c7be6aecfb1ccbfbedbc

See more details on using hashes here.

File details

Details for the file tinycolors-0.5.1.1-py3-none-any.whl.

File metadata

  • Download URL: tinycolors-0.5.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for tinycolors-0.5.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13dd19e239e51783b7c79c8732ca6a2f86a1c865e98dfd1bf89755083bb8a5ac
MD5 41c267381291470d88f4ebcfa4df36d6
BLAKE2b-256 a229b73ea8ea0262cade22e7480c3973a8c985ade4395cd49f698f526709767d

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