A Python library for terminal-colored text with 256-color and truecolor support
Project description
rgbterminal
rgbterminal is a lightweight Python library for terminal-colored text with both 256-color and truecolor (24-bit) support. It allows you to print colorful text in the terminal easily, with a convenient factory system for repeated colors.
Features
- Foreground 256-color and truecolor support
- Easy-to-use factory for creating multiple colored texts
- Access RGB values, cube levels, and terminal color codes
- Compatible with Python 3.10+
Installation
Install via pip:
##change## pip install rgbterminal ##change##
Usage
Basic Usage
##change## from rgbterminal import RGBText
256-color text
text1 = RGBText("Hello 256-color!", rgb=(120, 200, 80), truecolor=False) print(text1)
Truecolor text
text2 = RGBText("Hello Truecolor!", rgb=(120, 200, 80), truecolor=True) print(text2) ##change##
Using RGBTextFactory
##change## from rgbterminal import RGBTextFactory
factory = RGBTextFactory((255, 100, 50))
Generate multiple texts with same base color
t1 = factory.t("Factory 256-color text") t2 = factory.t_truecolor("Factory Truecolor text") t3 = factory.text("Another 256-color text")
print(t1) print(t2) print(t3)
Access properties
print("Factory RGB:", factory.r, factory.g, factory.b) print("Cube levels:", factory.r_level, factory.g_level, factory.b_level) print("256-color code:", factory.code) ##change##
Properties
For any RGBText object:
r,g,b→ RGB values (0-255)r_level,g_level,b_level→ Cube levels (0-5)red,green,blue→ aliases forr,g,bred_level,green_level,blue_level→ aliases for cube levelscode→ 256-color terminal codein_256color→ 256-color string for printing
Contributing
Contributions are welcome! Please fork the repo and submit a pull request.
License
MIT License
Project details
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 rgbterminal-0.1.0.tar.gz.
File metadata
- Download URL: rgbterminal-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb405d3001fe3d9a4240f0a131a5094a01260ef945793ebdb314268ecfd124d0
|
|
| MD5 |
aa9953c653b40c312c1768f7ad9c0368
|
|
| BLAKE2b-256 |
0e2c9ebb2d9d20fefe9a2f71d9dd9eb2d5d8494992ae6b0ee50d0afbb8b109aa
|
File details
Details for the file rgbterminal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rgbterminal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
357f02560a0d341a15b8cc2db816c24f7b697825271e07a53813c0d3c4874a54
|
|
| MD5 |
532815a2dfe5c4d4449426647256d108
|
|
| BLAKE2b-256 |
200eb600034e2b6dc984f584a7ed070d1603127e364a01380ec08d505c36dfba
|