Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dynstat/colorty
pip package for colored terminal texts
https://github.com/dynstat/colorty
pip python
Last synced: 27 days ago
JSON representation
pip package for colored terminal texts
- Host: GitHub
- URL: https://github.com/dynstat/colorty
- Owner: dynstat
- License: mit
- Created: 2024-07-02T21:18:55.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-15T06:56:14.000Z (4 months ago)
- Last Synced: 2024-12-02T01:44:30.939Z (about 1 month ago)
- Topics: pip, python
- Language: Python
- Homepage: https://pypi.org/project/colorty/
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```bash
pip install colorty
```
## UsageBasic example:
```python
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:
```python
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](LICENSE) file for details.
**Acknowledgments**: inspired from the Colorama library.