The simplest module for coloring terminal output via ansi codes. Originally from blender 3d source code.
Project description
Blendercolors
A simple module for coloring terminal output via ANSI codes. Based on the classic bcolors snippet from Blender 3D source code.
Works on all terminals with ANSI. (Linux, MacOS, modern Windows)
Features
- Simple ANSI color codes
- Cross-platform (works in most modern terminals)
- Lightweight and dependency-free
Installation
pip install blendercolors
Usage
from blendercolors import bcolors
print(f"{bcolors.WARNING}Yellow color for warnings{bcolors.ENDC}")
print(f"Three OK colors")
print(f" {bcolors.OKGREEN}green{bcolors.ENDC}, {bcolors.OKBLUE}blue{bcolors.ENDC} and {bcolors.OKCYAN}cyan{bcolors.ENDC}")
print(f"{bcolors.FAIL}Red for error texts{bcolors.ENDC}")
# And anytime your can disable all coloring without remove previos written, just place this string at top:
bcolors.disable()
Start coloring text with defined choiced color, finish coloring by bcolors.ENDC
ANSI codes:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
Based on the classic bcolors snippet popularized by Blender and Stack Overflow.
Inspired by stackoverflow post: https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal
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
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 blendercolors-0.1.1.tar.gz.
File metadata
- Download URL: blendercolors-0.1.1.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ded6c9b947577963ac985fd8bd244a063ccb9b04c1489c91b2ff1add8ea2b28
|
|
| MD5 |
1b412917c6b552104788c60024d3480c
|
|
| BLAKE2b-256 |
067c6ae0fbd19800015db81805e861c3ca2474aa310f23092823389d5146030c
|
File details
Details for the file blendercolors-0.1.1-py3-none-any.whl.
File metadata
- Download URL: blendercolors-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91e25b4c070baa732ba9447b15551f78e2c9c5ee73a7bd53f753b711fb041648
|
|
| MD5 |
8de9d4b5304a69b9c12044675a592dbf
|
|
| BLAKE2b-256 |
126bbb12d6875c20cb5bd23d93aa5131d6582d07d199de9d9142a42a5b06d410
|