Skip to main content

bruhcolor

Named and 256-color terminal text formatting for Python. No runtime dependencies. The companion formatter used by bruhanimate.

Requires Python 3.10 or newer. Development uses Python 3.13 and uv 0.13.4.

python -m pip install bruhcolor
from bruhcolor import bruhcolored

message = bruhcolored("Hello world!", color="red", on_color=194, attrs=["bold"])
print(message)
print(message.colored)  # ANSI string
print(message.text)     # original text
assert len(message) == 12

Foreground/background accept named colors or integers/numeric strings from 0 through 255, including zero (black). Named colors include black, red, green, yellow, blue, magenta, cyan, light_grey, dark_grey, light_red, light_green, light_yellow, light_blue, light_magenta, light_cyan and white; grey aliases black. Attributes: bold, dark, italic, underline, blink, reverse, concealed, crossed-out. Unknown colors/attributes are ignored for compatibility.

from bruhcolor import bruhcolored, colors, color_codes, valid_effects

label = bruhcolored("Ready", color=46)
print(f"{label:>12}")
assert label[:2] == "Re"
assert (label + "!").text == "Ready!"
assert (label * 2).text == "ReadyReady"
color_codes()
valid_effects()
colors(support="full")

Alignment supports a width and optional <, > or ^; length/indexing count Python characters, not terminal display cells. Slices return plain strings. Set ANSI_COLORS_DISABLED (any value) to disable all generated escape sequences. Imports and formatting do not print or open a terminal; only discovery helpers print.

Development

python -m pip install uv==0.13.4
uv sync --locked --python 3.13
uv run --locked ruff check .
uv run --locked mypy
uv run --locked pytest
uv run --locked python scripts/check_examples.py
uv run --locked python publish.py --check

uv.lock pins repository/CI environments. poetry-core is only the build backend; the Poetry CLI is not used. The former poetry.lock is superseded by uv.lock. The package keeps no runtime dependencies. CI covers Python 3.13 on Linux, Windows and macOS, plus the minimum Python 3.10 on Linux.

Releases

Develop on a feature/dev branch, merge reviewed changes into main, then explicitly push a matching vMAJOR.MINOR.PATCH tag when ready to publish. Main pushes run checks; they do not publish. See the release guide.

publish.py previews by default. --check validates the current version; --write bumps source versions and refreshes the lockfile. Git writes require additional explicit flags. The helper never creates a release tag or uploads. Legacy ignored publish.ps1/push_version.py are not part of this workflow.

Formatting corrections

The current working version fixes integer zero being treated as an absent color, removes the duplicate escape prefix from indexed backgrounds, and emits no reset when colors are disabled. Unsupported wrapper addition raises TypeError instead of printing and returning None. Metadata now declares Python >=3.10, matching the union annotations already used by the package. These corrections are covered by regression tests; the existing version number has not been bumped or published.

License

MIT. See LICENSE and retained upstream attribution in COPYING.txt.

Metadata

Release files for bruhcolor 0.0.66

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bruhcolor 0.0.66
File Size Uploaded Provenance Actions
bruhcolor-0.0.66.tar.gz 5.9 kB With provenance Details for bruhcolor-0.0.66.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bruhcolor 0.0.66
File Interpreter ABI Platform Actions
bruhcolor-0.0.66-py3-none-any.whl Python 3 none any Details for bruhcolor-0.0.66-py3-none-any.whl

Total release size: 13.5 kB

Release files / bruhcolor-0.0.66.tar.gz

Download URL bruhcolor-0.0.66.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b207120f59e0b8fc675bd27f3bc06e79410889ea45bac46f0621de04dae23a22
BLAKE2b-256 checksum
How to use checksums
743c289176cae526618a5220bbe1d7d91e1ed58ac9addc7880154dbd2759c3e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / bruhcolor-0.0.66-py3-none-any.whl

Download URL bruhcolor-0.0.66-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55b7830d40f77903caba69b8f26f9303a7c2caf889ff4d23e59adc6cf77e0b8c
BLAKE2b-256 checksum
How to use checksums
b10f21a925b0d3c8802f1b600f0ca5256fbf5346aa531d0f1ee78115990edaae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for bruhcolor 0.0.66

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bruhcolor-0.0.66.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.0.66 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page