Detect whether a terminal supports color
Project description
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.
- Twitter: @theshawwn
- Patreon: https://www.patreon.com/shawwn
- HN: sillysaurusx
- Website: shawwn.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
supports-color-0.1.2.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for supports_color-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43403dd59a40583d3da13330cbcfcd41711748881671598c27f260441d2cb3d1 |
|
MD5 | 3432b954915239a2fb49f0a3b952f303 |
|
BLAKE2b-256 | 4dbe2bccbbd379b950f676b9dd1729dbe1753efb722a11e7718863b66048ede5 |