Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 2, 2024 via pnpm

color-support 1.1.3

A module which will endeavor to guess your terminal's level of color support.
Package summary
Share
0
issues
1
license
1
ISC
Package created
17 Jul 2016
Version published
6 Jun 2017
Maintainers
1
Total deps
1
Direct deps
0
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
color-support@1.1.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of color-support 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does color-support do?

The color-support is an npm package created to guess the level of color support your terminal has. This JavaScript module helps in figuring out whether your terminal supports basic colors, 256 colors, or 16 million colors. It uses several parameters such as the Node environment, TTY status, 'TERM' environ, Windows or Tmux usage, and specific environment variables to make these determinations.

How do you use color-support?

To use color-support in your application, you first need to install it using npm and then require it in your JavaScript file. Below is a basic example:

var testColorSupport = require('color-support');
var colorSupport = testColorSupport();

if (!colorSupport) {
  console.log('color is not supported');
} else if (colorSupport.has16m) {
  console.log('\x1b[38;2;102;194;255m16m colors\x1b[0m');
} else if (colorSupport.has256) {
  console.log('\x1b[38;5;119m256 colors\x1b[0m');
} else if (colorSupport.hasBasic) {
  console.log('\x1b[31mbasic colors\x1b[0m');
} else {
  console.log('this is impossible, but colors are not supported');
}

In the above code, an options object can optionally be passed to the testColorSupport function. If no options are passed, the returned value will either be false or an object with color-support information.

Where are the color-support docs?

The color-support documentation can be found on the GitHub repository for this package at https://github.com/isaacs/color-support. The readme file that comes with the package has a detailed explanation of the module's usage and options. This includes the option to ignore the isTTY check, TERM=dumb environ check, and CI environ check. It also explains the return value when no color support is available.