Skip to content

shawwn/supports-color-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

supports-color

Detect whether a terminal supports color

A port of the Node.js package supports-color to Python.

Install

python3 -m pip install -U supports-color

Usage

from supports_color import supportsColor

if supportsColor.stdout:
    print('Terminal stdout supports color');

if supportsColor.stdout.has256:
    print('Terminal stdout supports 256 colors');

if supportsColor.stderr.has16m:
    print('Terminal stderr supports 16 million colors (truecolor)');

API

See chalk/supports-color API docs.

License

MIT

Contact

A library by Shawn Presser. If you found it useful, please consider joining my patreon!

My Twitter DMs are always open; you should send me one! It's the best way to reach me, and I'm always happy to hear from you.

About

Detect whether a terminal supports color

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages