Skip to main content

Drop-in [termcolor](https://pypi.org/project/termcolor/) replacement with enums and type hinting

Project description

Examples

import sys
from termcolor_enum import *

text = colored('Hello, World!', Colors.RED, attrs=[Attributes.REVERSE, Attributes.BLINK])
print(text)
cprint('Hello, World!', 'green', Highlights.ON_RED)

print_red_on_cyan = lambda x: cprint(x, 'red', 'on_cyan')
print_red_on_cyan('Hello, World!')
print_red_on_cyan('Hello, Universe!')

for i in range(10):
    cprint(i, 'magenta', end=' ')

cprint("Attention!", 'red', attrs=['bold'], file=sys.stderr)

Text Colors (termcolor_enum.Colors):

Color String Enum Value
Grey 'grey' GREY
Red 'red' RED
Green 'green' GREEN
Yellow 'yellow' YELLOW
Blue 'blue' BLUE
Magenta 'magenta' MAGENTA
Cyan 'cyan' CYAN
White 'white' WHITE

Text Highlights (termcolor_enum.Highlights):

Highlight String Enum Value
On Grey 'on_grey' ON_GREY
On Red 'on_red' ON_RED
On Green 'on_green' ON_GREEN
On Yellow 'on_yellow' ON_YELLOW
On Blue 'on_blue' ON_BLUE
On Magenta 'on_magenta' ON_MAGENTA
On Cyan 'on_cyan' ON_CYAN
On White 'on_white' ON_WHITE

Text Attributes (termcolor_enum.Attributes):

Attribute String Enum Value
Bold 'bold' BOLD
Dark 'dark' DARK
Underline 'underline' UNDERLINE
Blink 'blink' BLINK
Reverse 'reverse' REVERSE
Concealed 'concealed' CONCEALED

Terminal Compatibility

Terminal Bold Dark Underline Blink Reverse Concealed
xterm yes no yes bold yes yes
linux yes yes bold yes yes no
rxvt yes no yes bold/black yes no
dtterm yes yes yes reverse yes yes
teraterm reverse no yes rev/red yes no
aixterm normal no yes no yes yes
PuTTY color no yes no yes no
Windows no no no no yes no
Cygwin SSH yes no color color color yes
Mac Terminal yes no yes yes yes yes

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

termcolor-enum-1.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

termcolor_enum-1.2.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file termcolor-enum-1.2.0.tar.gz.

File metadata

  • Download URL: termcolor-enum-1.2.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Linux/5.10.79-1-MANJARO

File hashes

Hashes for termcolor-enum-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ad7663f75e771bf5e6092d64d4773c067ebebef340aa3527020a2b30459e9e0a
MD5 5ec93ef87027a5ac8040eb5e0f309307
BLAKE2b-256 bdadf3c9b9b6dd7fc5e8f2c096a415f1160d53dc75e693189c336b86fe1ee71c

See more details on using hashes here.

File details

Details for the file termcolor_enum-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: termcolor_enum-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Linux/5.10.79-1-MANJARO

File hashes

Hashes for termcolor_enum-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e855f12deae504f3f4c1db6b7f3ec9b42086ec6c78377d6930d9be5380574d5e
MD5 098c25e360458db3da01f9851ca2f534
BLAKE2b-256 97745ed522ebe55a525678519a3005a63c913ae4cae3ae6a861ce23ecc8bf0f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page