CLI-Colors
A light-weight library for accessible terminal colors.
This is mainly taken from this Stack Overflow answer
Installation
cli_colors is available on PyPI and can be installed using pip
pip install ansi-cli-colors
For a local/dev install from a clone of this repo:
pip3 install .
python3 -m pip install .
Usage
The library provides two functions color_print and color_str and a handful of named colors and modifiers.
To use cli_colors, pass the text to be printed, the color of the text, and a list of modifiers to either of the functions, the only difference is that color_print prints the modified text, while color_str returns it.
cli_colors also provides the color_generator function. This loops over and yields a list of objects infinitely, to provide iterating colors or "themes" when repeatedly printing.
Examples
# Print yellow text
color_print("Yellow Text\n", YELLOW)
# Print blue bold crossed-out text
color_print("Blue Text\n", BLUE, MOD_BOLD, MOD_CROSS_OUT)
# Print using an RGB color
color_print("RGB Text\n", (255, 255, 100))
# Pass a custom 8-bit color
color_print("Custom 8-bit Text\n", MOD_8BIT + "52", MOD_ITALIC)
# Color Generator
gen = color_generator([RED_SHADE1, RED_SHADE2])
for i in range(5):
color_print(f"Line {i}", next(gen))
# Generating Themes
theme_gen = color_generator([[BLUE_SHADE1, MOD_UNDERLINE], [RED_SHADE2, MOD_ITALIC]])
for i in range(5):
color_print(f"Line {i}", *next(theme_gen))
Metadata
Release files for ansi-cli-colors 1.0.2
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 |
|---|---|---|---|---|
| ansi_cli_colors-1.0.2.tar.gz | 4.3 kB | With provenance | Details for ansi_cli_colors-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ansi_cli_colors-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for ansi_cli_colors-1.0.2-py3-none-any.whl |
Total release size: 9.3 kB
Release files / ansi_cli_colors-1.0.2.tar.gz
| Download URL | ansi_cli_colors-1.0.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73df21f2096824b333165f56cba4aaa5b9d0eb957322940810ab798312e64adf
|
|
BLAKE2b-256 checksum How to use checksums |
174516a905e62e39a294bff5eb75cfb7cf7c87464c885591ac0ce9db64111df9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 21, 2026.
Transparency logRelease files / ansi_cli_colors-1.0.2-py3-none-any.whl
| Download URL | ansi_cli_colors-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
227ce69785fb6edfe0c03b33f11f1d766affa49048e30c3279cd82c96cf16b29
|
|
BLAKE2b-256 checksum How to use checksums |
f0fdd8587b6e39a10218b77e7d4510e984bfb67c00c12d8f22530ceda7cc7e91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 21, 2026.
Transparency logSecurity for ansi-cli-colors 1.0.2
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.
Attestation for ansi_cli_colors-1.0.2.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 Aug 21, 2026.
Transparency logA 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.