colorex-py
colorex-py is a simple and flexible Python Module that provides an easy way to style your terminal output with color and text formatting. With support for both RGB and HEX color codes, as well as text styles like bold, italic, underline, strikethrough, and more, it makes your terminal applications visually more appealing and readable.
Features
- RGB Color Support: Define colors using RGB values (e.g., color_rgb(255, 0, 0)).
- HEX Color Support: Use HEX color codes (e.g., color_hex("#FF0000")).
- Text Styles: Bold, italic, underline, strikethrough, dim, and inverted text.
- Background Colors: Set the background color using RGB or HEX.
- Chainable API: Apply multiple styles in a single statement using method chaining.
Installation
To install colorex-py, you can use pip:
pip install colorex-py
Usage
Here's how you can use colorex to add color and styles to your terminal output:
from colorex import stylize
# Example usage
print(stylize("Hello, World!").color("0,255,0")) # Green text
print(stylize("Error!").color("#FF0000")) # Red text
print(stylize("Bold Text").bold()) # Bold text
print(stylize("Italic Text").italic()) # Italic text
print(stylize("Underlined Text").underline()) # Underlined text
print(stylize("Strikethrough Text").strikethrough()) # Strikethrough text
print(stylize("Dim Text").dim()) # Dim text
print(stylize("Inverted Text").invert()) # Inverted background text
print(stylize("Background Color").bg_color("0,0,255")) # Blue background
# Combining multiple styles
print(stylize("ALL")
.color("0,255,0")
.bold()
.italic()
.underline()
.strikethrough()
.dim()
.invert()
.bg_color("0,0,255")) # All styles applied
Supported Styles
- Color: RGB and HEX color formats.
- Text Styles:
- bold()
- italic()
- underline()
- strikethrough()
- dim()
- invert()
- Background Colors: bg_color() with RGB or HEX values.
Example Output
The following example would result in a green-colored "Hello, World!" and a red "Error!" message in the terminal.
print(stylize("Hello, World!").color("0,255,0")) # Green text
print(stylize("Error!").color("#FF0000")) # Red text
Supported Color Formats
- RGB:
"r,g,b"(e.g.,"255,0,0"for red). - HEX:
"#RRGGBB"(e.g.,"#FF0000"for red).
License
This project is licensed under the MPL-2.0 License - see the LICENSE file for details.
Metadata
Release files for colorex-py 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| colorex_py-0.1.5.tar.gz | 7.4 kB | Without provenance | Details for colorex_py-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| colorex_py-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for colorex_py-0.1.5-py3-none-any.whl |
Total release size: 15.7 kB
Release files / colorex_py-0.1.5.tar.gz
| Download URL | colorex_py-0.1.5.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab0f826c4f83a0a7bd72ef5352b29bf7b445ca9127c42f826b481fbad3d4b5b6
|
|
BLAKE2b-256 checksum How to use checksums |
d7903b3fee3a6245e43760e6fc436e43f1acdc21097fa9e966345773c300c3c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-1020-azure
|
Release files / colorex_py-0.1.5-py3-none-any.whl
| Download URL | colorex_py-0.1.5-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
717bb2440c17cf62e19da35a10ca7467c41e03cdb7a6fea8e9c5070eb4529f0e
|
|
BLAKE2b-256 checksum How to use checksums |
126297c1bc3c8bfdfb414afbe5e9bba4ede8a339d3dfe723c2ff225b16f91dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-1020-azure
|
Security for colorex-py 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.