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('RED') # Set text color to red using color name
print("This text is red")
set_color('31') # Set text color to red using ANSI code
print("This text is still red")
set_color('GREEN') # Set text color to green using color name
print("This text is green")
set_color(32) # Set text color to green using ANSI code
print("This text is still 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colorty-0.1.6.tar.gz.
File metadata
- Download URL: colorty-0.1.6.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aef3676ea8eb58a171f06b672f16364876187957bb0c52ba9c9bf647c9d7fdb
|
|
| MD5 |
8bcd49a5ed82c4ac436ccd6d436d8753
|
|
| BLAKE2b-256 |
0fa0f4b9f10018745ade9c04e32d5ef4e0f7939c191da4a922fc6855a5ae2e18
|
File details
Details for the file colorty-0.1.6-py3-none-any.whl.
File metadata
- Download URL: colorty-0.1.6-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ed83a5b3555e48d674c891edcf00a5a26739b1d982798d9d0c4480898354c93
|
|
| MD5 |
02be493a8bfdb043cb1c2ea24f4766ef
|
|
| BLAKE2b-256 |
2f6b263514f5794c2c02317771c98f215d3a912a662bf72bbb1f6d7e080038b1
|