Skip to main content

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.

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

supports-color-0.2.0.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file supports-color-0.2.0.tar.gz.

File metadata

  • Download URL: supports-color-0.2.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for supports-color-0.2.0.tar.gz
Algorithm Hash digest
SHA256 209d3e5c7f267b9b7c2dfbae9e2c546ea386b43f1855ccc96639e2769d042d14
MD5 5dd1af9ddd8bb512dadf149b10002d0f
BLAKE2b-256 74f8b4cae888902982943738420cc0594f30a4a5926bf4a7ededa2ad8679645b

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