Skip to content

razkar-studio/tinycolors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A tiny, useful, and readable color library for fast colors, and a large library. Having a very large library of colorization and super readable syntax, tinycolors is the color library you were looking for.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages