Socket
Socket
Sign inDemoInstall

supports-color

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supports-color - npm Package Compare versions

Comparing version 5.5.0 to 6.0.0

28

index.js

@@ -5,3 +5,3 @@ 'use strict';

const env = process.env;
const {env} = process;

@@ -12,3 +12,3 @@ let forceColor;

hasFlag('color=false')) {
forceColor = false;
forceColor = 0;
} else if (hasFlag('color') ||

@@ -18,6 +18,12 @@ hasFlag('colors') ||

hasFlag('color=always')) {
forceColor = true;
forceColor = 1;
}
if ('FORCE_COLOR' in env) {
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
if (env.FORCE_COLOR === true || env.FORCE_COLOR === 'true') {
forceColor = 1;
} else if (env.FORCE_COLOR === false || env.FORCE_COLOR === 'false') {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}

@@ -39,3 +45,3 @@

function supportsColor(stream) {
if (forceColor === false) {
if (forceColor === 0) {
return 0;

@@ -54,8 +60,12 @@ }

if (stream && !stream.isTTY && forceColor !== true) {
if (stream && !stream.isTTY && forceColor === undefined) {
return 0;
}
const min = forceColor ? 1 : 0;
const min = forceColor || 0;
if (env.TERM === 'dumb') {
return min;
}
if (process.platform === 'win32') {

@@ -120,6 +130,2 @@ // Node.js 7.5.0 is the first version of Node.js to include a patch to

if (env.TERM === 'dumb') {
return min;
}
return min;

@@ -126,0 +132,0 @@ }

{
"name": "supports-color",
"version": "5.5.0",
"version": "6.0.0",
"description": "Detect whether a terminal supports color",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=4"
"node": ">=6"
},

@@ -51,5 +51,5 @@ "scripts": {

"import-fresh": "^2.0.0",
"xo": "^0.20.0"
"xo": "^0.23.0"
},
"browser": "browser.js"
}

@@ -5,3 +5,17 @@ # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)

---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install

@@ -48,3 +62,3 @@

Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.

@@ -51,0 +65,0 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.

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