Lightweight package that makes it easy and fast to print colored text in the terminal
Project description
🌈 Colorist for Python 🌈
Lightweight Python package that makes it easy and fast to print colored text in the terminal.
Ready to try? See how to install.
Getting Started
Print Line of Colored Text
How to print a full line of colored text in the terminal:
from colorist import green, yellow, red
green("This is GREEN!")
yellow("This is YELLOW!")
red("This is RED!")
How it appears in the terminal:
Print Mixed Text Colors
How to customize colors inside a paragraph and print it in the terminal:
from colorist import Color
print(f"I want {Color.RED}red{Color.OFF} color inside this paragraph")
print(f"Both {Color.GREEN}green{Color.OFF} and {Color.YELLOW}yellow{Color.OFF} are nice colors")
How it appears in the terminal:
Other Styling Options
Print Bright Colors
Most terminals support bright colors that stand more out:
from colorist import BrightColor
print(f"I want {BrightColor.CYAN}cyan{BrightColor.OFF} color inside this paragraph")
How it appears in the terminal:
Remember to use Color.OFF or BrightColor.OFF every time you want to revert back to the default terminal text style. Otherwise, the color may spill over and into other terminal messages.
Print Background Colors
from colorist import bg_green, bg_yellow, bg_red
bg_green("This is GREEN background!")
bg_yellow("This is YELLOW background!")
bg_red("This is RED background!")
How it appears in the terminal:
Background colors can also be mixed inside a paragraph:
from colorist import BgColor
print(f"I want {BgColor.RED}red{BgColor.OFF} background color inside this paragraph")
print(f"Both {BgColor.GREEN}green{BgColor.OFF} and {BgColor.YELLOW}yellow{BgColor.OFF} are nice background colors")
How it appears in the terminal:
from colorist import BgBrightColor
print(f"I want {BgBrightColor.CYAN}cyan{BgBrightColor.OFF} background color inside this paragraph")
How it appears in the terminal:
As with text colors, remember to use BgColor.OFF or BgBrightColor.OFF every time you want to revert back to the default terminal text style. Otherwise, the color may spill over and into other terminal messages.
Foreground Text
| Color | Full Text Function | Color Code | Example |
|---|---|---|---|
green("text") |
Color.GREEN |
||
yellow("text") |
Color.YELLOW |
||
red("text") |
Color.RED |
||
magenta("text") |
Color.MAGENTA |
||
blue("text") |
Color.BLUE |
||
cyan("text") |
Color.CYAN |
||
white("text") |
Color.WHITE |
||
black("text") |
Color.BLACK |
||
| - | - | Color.DEFAULT |
- |
| - | - | Color.OFF |
- |
bright_green("text") |
BrightColor.GREEN |
||
bright_yellow("text") |
BrightColor.YELLOW |
||
bright_red("text") |
BrightColor.RED |
||
bright_magenta("text") |
BrightColor.MAGENTA |
||
bright_blue("text") |
BrightColor.BLUE |
||
bright_cyan("text") |
BrightColor.CYAN |
||
bright_white("text") |
BrightColor.WHITE |
||
bright_black("text") |
BrightColor.BLACK |
||
| - | - | BrightColor.DEFAULT |
- |
| - | - | BrightColor.OFF |
- |
Background
| Color | Full Text Function | Color Code | Example |
|---|---|---|---|
bg_green("text") |
BgColor.GREEN |
||
bg_yellow("text") |
BgColor.YELLOW |
||
bg_red("text") |
BgColor.RED |
||
bg_magenta("text") |
BgColor.MAGENTA |
||
bg_blue("text") |
BgColor.BLUE |
||
bg_cyan("text") |
BgColor.CYAN |
||
bg_white("text") |
BgColor.WHITE |
||
bg_black("text") |
BgColor.BLACK |
||
| - | - | BgColor.DEFAULT |
- |
| - | - | BgColor.OFF |
- |
bg_bright_green("text") |
BgBrightColor.GREEN |
||
bg_bright_yellow("text") |
BgBrightColor.YELLOW |
||
bg_bright_red("text") |
BgBrightColor.RED |
||
bg_bright_magenta("text") |
BgBrightColor.MAGENTA |
||
bg_bright_blue("text") |
BgBrightColor.BLUE |
||
bg_bright_cyan("text") |
BgBrightColor.CYAN |
||
bg_bright_white("text") |
BgBrightColor.WHITE |
||
bg_bright_black("text") |
BgBrightColor.BLACK |
||
| - | - | BgBrightColor.DEFAULT |
- |
| - | - | BgBrightColor.OFF |
- |
Become a Sponsor 🏅
If you find this project helpful, please consider supporting its development. Your donations will help keep it alive and growing. Every contribution makes a difference, whether you buy a coffee or support with a monthly donation. Find your tier here:
Thank you for your support! 🙌
Contribute
If you have suggestions or changes to the module, feel free to add to the code and create a pull request.
Report Bugs
If you encounter any issues, you can report them as bugs or raise issues.
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 colorist-1.8.12.tar.gz.
File metadata
- Download URL: colorist-1.8.12.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8512dd8df8c4ce30f6faa833ddc8ec4c3ccb2e517223d187af50e199dd8104c
|
|
| MD5 |
49ce86c98ae9e288771dd6b0d41bffe8
|
|
| BLAKE2b-256 |
ea9d4ec39bbd727c4fdad9b8d676841178b8cb69ffa5697dc27a2852e5bedff1
|
Provenance
The following attestation bundles were made for colorist-1.8.12.tar.gz:
Publisher:
release.yml on jakob-bagterp/colorist-for-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colorist-1.8.12.tar.gz -
Subject digest:
b8512dd8df8c4ce30f6faa833ddc8ec4c3ccb2e517223d187af50e199dd8104c - Sigstore transparency entry: 942440705
- Sigstore integration time:
-
Permalink:
jakob-bagterp/colorist-for-python@7057b33eb69623aa7b79427597915ed4e8da9170 -
Branch / Tag:
refs/tags/v1.8.12 - Owner: https://github.com/jakob-bagterp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7057b33eb69623aa7b79427597915ed4e8da9170 -
Trigger Event:
push
-
Statement type:
File details
Details for the file colorist-1.8.12-py3-none-any.whl.
File metadata
- Download URL: colorist-1.8.12-py3-none-any.whl
- Upload date:
- Size: 46.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f26296c4eb351cebff70cb64f2ea35e6b67db7bff7af43e25455e01c9d46f02
|
|
| MD5 |
6016321793c2d095fac30acf9735eb77
|
|
| BLAKE2b-256 |
44b3f3b4170ecf4d169dd0495a44e6735b76c41ac0f4c6b19ebca2e75103f250
|
Provenance
The following attestation bundles were made for colorist-1.8.12-py3-none-any.whl:
Publisher:
release.yml on jakob-bagterp/colorist-for-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colorist-1.8.12-py3-none-any.whl -
Subject digest:
5f26296c4eb351cebff70cb64f2ea35e6b67db7bff7af43e25455e01c9d46f02 - Sigstore transparency entry: 942440712
- Sigstore integration time:
-
Permalink:
jakob-bagterp/colorist-for-python@7057b33eb69623aa7b79427597915ed4e8da9170 -
Branch / Tag:
refs/tags/v1.8.12 - Owner: https://github.com/jakob-bagterp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7057b33eb69623aa7b79427597915ed4e8da9170 -
Trigger Event:
push
-
Statement type: