You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

has-color

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-color

Detect whether a terminal supports color

0.1.7
Source
npmnpm
Version published
Weekly downloads
842K
-10.08%
Maintainers
1
Weekly downloads
 
Created

What is has-color?

The has-color npm package is a utility that checks if the terminal supports color. It is useful for developers who want to conditionally enable or disable color output in their command-line applications based on the terminal's capabilities.

What are has-color's main functionalities?

Check if terminal supports color

This feature allows you to check if the terminal supports color. The code sample demonstrates how to require the has-color package and log whether the terminal supports color.

const hasColor = require('has-color');
console.log(hasColor); // true or false

Check if specific stream supports color

This feature allows you to check if a specific stream, such as process.stdout, supports color. The code sample shows how to pass the stream to the has-color function and log the result.

const hasColor = require('has-color');
console.log(hasColor(process.stdout)); // true or false

Other packages similar to has-color

Keywords

color

FAQs

Package last updated on 16 Apr 2014

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