A simple library for handling colored text in terminal environments.
Project description
Colorty
Colorty is a Python library for handling colored text in various terminal environments including Windows CMD, PowerShell, and Unix-like terminals on Ubuntu and macOS.
Installation
Install Colorty using pip:
pip install colorty
Usage
Basic example:
from colorty import set_color, reset_color
set_color('31') # Set text color to red
print("This text is red")
print("This text is still red")
set_color('32') Â # Set text color to green
print("This text is green")
reset_color() Â Â # Reset text color to default
print("This text is default color")
Using the Clt
class:
from colorty import Clt
# format partial string with color
print(f"This is {Clt.RED}partial red{Clt.RESET} and {Clt.BLUE}partial blue{Clt.RESET} text.")
API Reference
set_color(color)
: Sets the terminal text color.reset_color()
: Resets the terminal text color to default.Clt
: Class with predefined ANSI color codes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments: inspired from the Colorama library.
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
colorty-0.1.5.tar.gz
(4.1 kB
view hashes)