Skip to main content

The simplest module for color terminal output. Use ANSI sequences, working almost everywhere, no dependecies.

Project description

Blendercolors

A simple module for coloring terminal output via ANSI codes with a few colors.

Works on all terminals with ANSI. (Linux, MacOS, modern Windows)

Lightweight and dependency-free

What you get

Just put inside f-string in print() function: Demo

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 others color and formatting.

Start coloring text with defined choiced color, finish coloring by bcolors.ENDC

ANSI codes:

    HEADEanytimeR = '\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'

Anytime your can disable all coloring without removing previos written code, just place at top of program:

bcolors.disable()

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

blendercolors-0.1.4.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

blendercolors-0.1.4-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file blendercolors-0.1.4.tar.gz.

File metadata

  • Download URL: blendercolors-0.1.4.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

Hashes for blendercolors-0.1.4.tar.gz
Algorithm Hash digest
SHA256 501ec6c9d12deff3e6111d93cdd60b9047c34f2464b8dedd6a47325b3be08373
MD5 5bde523bcd9347faaf320c7db8d8eb07
BLAKE2b-256 38ff3e59e2e3ec58a18fe994f21e775e78be46160ab275e3958d1a313e6ccc2b

See more details on using hashes here.

File details

Details for the file blendercolors-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: blendercolors-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for blendercolors-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7b138ba56d5ffb24d43b9fb86222970c0c78645a7df0a2bc260c9d2259c4f896
MD5 c448424c069c59206ccefbdc07d672f7
BLAKE2b-256 6a6c44b65326c6f430011be35cb7cf6b494fd84d6a13dc3f9ebf442e7cbd5f2c

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