Socket
Socket
Sign inDemoInstall

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


Version published
Weekly downloads
500K
increased by2.19%
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

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

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