Skip to content

stephen-bunn/chalky

Repository files navigation

Chalky

Supported Versions Test Status Documentation Status Codecov Code Style: Black

Simple ANSI terminal text coloring

Yet another terminal text coloring library…

Why? Because, I like certain things and I hate certain things about the currently available solutions. This here is my attempt to build an interface for simply applying ANSI escape sequences to strings that I enjoy and can update at my own free will. That is it, there is nothing new or interesting that this packages adds. Thanks 🎉

For more interesting details, please visit the documentation.

Style Composition

from chalky import sty, fg

my_style = sty.bold & fg.red
print(my_style | "This is red on black")
print(my_style.reverse | "This is black on red")

Basic Colors

Style Chaining

from chalky import chain

print(chain.bold.green | "I'm bold green text")
print(chain.white.bg.red.italic | "I'm italic white text on a red background")

Style Colors

Truecolor

from chalky import rgb, sty, hex

print(rgb(23, 255, 122) & sty.italic | "Truecolor as well")
print(sty.bold & hex("#ff02ff") | "More and more colors")

True Colors

Disable Colors

from chalky import configure, fg

print(fg.red | "I am red text")
configure(disable=True)
print(fg.red | "I am NOT red text")

Configure