Socket
Socket
Sign inDemoInstall

@types/supports-color

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/supports-color

TypeScript definitions for supports-color


Version published
Weekly downloads
971K
decreased by-1.83%
Maintainers
1
Weekly downloads
 
Created

What is @types/supports-color?

@types/supports-color is a TypeScript type definition package for the 'supports-color' npm package. The 'supports-color' package is used to detect whether the terminal supports color output, which is useful for creating command-line applications that can adapt their output based on the terminal's capabilities.

What are @types/supports-color's main functionalities?

Check if terminal supports color

This feature allows you to check if the terminal supports color output. The 'supportsColor.stdout' property returns a boolean indicating whether the terminal supports color.

const supportsColor = require('supports-color');

if (supportsColor.stdout) {
  console.log('Terminal supports color');
} else {
  console.log('Terminal does not support color');
}

Check color level support

This feature allows you to check the level of color support in the terminal. The 'supportsColor.stdout.level' property returns a number indicating the level of color support (0 for no color, 1 for basic color, 2 for 256 colors, and 3 for truecolor).

const supportsColor = require('supports-color');

if (supportsColor.stdout) {
  console.log(`Color level: ${supportsColor.stdout.level}`);
} else {
  console.log('Terminal does not support color');
}

Other packages similar to @types/supports-color

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc