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:

    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'

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

PyPI Downloads

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.5.tar.gz (14.7 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.5-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blendercolors-0.1.5.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for blendercolors-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8e7e4f6e41f599e626ce53612babc16077d3fd89a3f48879262ae048288f2f50
MD5 02fa848106fc49a3add2e0dbab4b0116
BLAKE2b-256 373a9883dd08b30e6ec365a3cb231ad2de249d2f76a48787178c7a21881c02cf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for blendercolors-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 56fddcf8e69242dd1afe25c0a463988e9609b8df1484aa12ad1fd4f69d3d3e2e
MD5 4029c4cdba3a6ca3e7eebecd38c28f84
BLAKE2b-256 b74132bbfe125ba2621c8b53ea2801a12eca4ec5a1ec09bae643893c43b08a5d

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