tcolorpy

0.1.7 · active · verified Fri Apr 10

tcolorpy is a Python library designed to apply true color (24-bit RGB) for terminal text, providing a rich set of methods to style strings with foreground, background, and various ANSI effects. The current version is 0.1.7, and the project maintains an active, though not rapid, release cadence with a focus on Python version compatibility and packaging improvements.

Warnings

Install

Imports

Quickstart

Demonstrates basic usage of predefined colors, custom RGB, 256-color ANSI codes, and checking terminal true color capability.

import tcolorpy as color

# Basic red text
print(color.RED('Hello, tcolorpy!'))

# Custom RGB color with bold style
print(color.RgbColor(255, 100, 0, 'Orange Bold Text').bold())

# 256-color foreground and background
print(color.AnsiFgColor(27, 'Deep Green FG') + color.AnsiBgColor(235, ' Dark Gray BG'))

# Check if the terminal supports true colors
if color.is_true_color_terminal():
    print(color.BLUE('Your terminal supports true colors!'))
else:
    print(color.YELLOW('True color support not detected.'))

view raw JSON →