Skip to main content

256 Color Terminal Text Formatter

Project description

bruhcolor

Supported Python versions

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))

sample-run

  • Color Codes: 0 - 255
  • Highlight Codes: 0 - 255
  • Attributes: blink, reverse, bold, crossed-out, italic, underline, dark, concealed

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

bruhcolor-0.0.51.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bruhcolor-0.0.51-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

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

Hashes for bruhcolor-0.0.51.tar.gz
Algorithm Hash digest
SHA256 9bea25e6658af411f6d0a512a392eb00b865f7487fb9c8b8a06cdaff498f9f0c
MD5 b03b4752d7631234eb3bf597afdaa0b2
BLAKE2b-256 0ef510cd263a7d3ac76959f5ba4f64aca6230bfd379b8bb789b6037b886f01e1

See more details on using hashes here.

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

Hashes for bruhcolor-0.0.51-py3-none-any.whl
Algorithm Hash digest
SHA256 8d9dc0289370e2a5af67b059067a4a8f46e0fe81ceb2d42f6d8a9a9bedb07ed7
MD5 6028be83b27c939058078e7c4eeb6856
BLAKE2b-256 75e35ce9fcf0502c20397233c352703d95ed7553aa2ff32259b8be0f1fbb5bf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page