256 Color Terminal Text Formatter
Project description
bruhcolor
What is bruhcolor you may ask?
bruhcolor is a terminal coloring package similar to termcolor with some differences.
First, bruhcolor supports 256 colors (given your terminal can supoprt that). Along with this, it offers a few more options for customizing the text compared to termcolor.
Another major difference is the the use of a wrapper class, rather than returning the escape-sequenced string. When using python's len() method on this color-coded strings, it would return a length that included the escape charcaters. Perhaps this is intended in one use case, but for mine it was not. Thus, a wrapper class was made. This wrapper class can give back the length of the pre-colored text when using python's len() method. ALong with this, using something like a f-string could be trouble some . . . again given the fact the length of a colored string is significantly longer than the orginal text. The wrapper class allows for better formatting with f-strings, allowing the formatter to treat the colored text the same as it would the original, unmodified version.
Installation
From PyPI
python -m pip install --upgrade bruhcolor
From source
git clone https://github.com/ethanlchristensen/bruhcolor
cd bruhcolor
python -m pip install .
Example / Usage
import bruhcolor
# Display all of the color codes
bruhcolor.colors()
# Simple test message
test_1 = bruhcolor.bruhcolored("Hello World from bruhcolor!", color=24)
print(test_1)
# Support mult repition
print(test_1 * 5)
print()
# More in depth example
test_2 = bruhcolor.bruhcolored("Hello World from bruhcolor!", color=24, on_color=196, attrs=['blink', 'reverse', 'italic'])
print(test_2)
print()
test_3 = test_1 + test_2
print(test_3)
test_3 += "How are you doing?"
print(test_3)
print()
# Getting lengths
print(len(test_1))
print(len(test_2))
print(len(test_3))
- Color Codes: 0 - 255
- Highlight Codes: 0 - 255
- Attributes: blink, reverse, bold, crossed-out, italic, underline, dark, concealed
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 bruhcolor-0.0.51.tar.gz.
File metadata
- Download URL: bruhcolor-0.0.51.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bea25e6658af411f6d0a512a392eb00b865f7487fb9c8b8a06cdaff498f9f0c
|
|
| MD5 |
b03b4752d7631234eb3bf597afdaa0b2
|
|
| BLAKE2b-256 |
0ef510cd263a7d3ac76959f5ba4f64aca6230bfd379b8bb789b6037b886f01e1
|
File details
Details for the file bruhcolor-0.0.51-py3-none-any.whl.
File metadata
- Download URL: bruhcolor-0.0.51-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d9dc0289370e2a5af67b059067a4a8f46e0fe81ceb2d42f6d8a9a9bedb07ed7
|
|
| MD5 |
6028be83b27c939058078e7c4eeb6856
|
|
| BLAKE2b-256 |
75e35ce9fcf0502c20397233c352703d95ed7553aa2ff32259b8be0f1fbb5bf9
|