Socket
Socket
Sign inDemoInstall

supports-color

Package Overview
Dependencies
1
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0 to 7.1.0

15

index.js
'use strict';
const os = require('os');
const tty = require('tty');
const hasFlag = require('has-flag');

@@ -43,3 +44,3 @@

function supportsColor(stream) {
function supportsColor(haveStream, streamIsTTY) {
if (forceColor === 0) {

@@ -59,3 +60,3 @@ return 0;

if (stream && !stream.isTTY && forceColor === undefined) {
if (haveStream && !streamIsTTY && forceColor === undefined) {
return 0;

@@ -96,2 +97,6 @@ }

if ('GITHUB_ACTIONS' in env) {
return 1;
}
if (env.COLORTERM === 'truecolor') {

@@ -129,3 +134,3 @@ return 3;

function getSupportLevel(stream) {
const level = supportsColor(stream);
const level = supportsColor(stream, stream && stream.isTTY);
return translateLevel(level);

@@ -136,4 +141,4 @@ }

supportsColor: getSupportLevel,
stdout: getSupportLevel(process.stdout),
stderr: getSupportLevel(process.stderr)
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
};
{
"name": "supports-color",
"version": "7.0.0",
"version": "7.1.0",
"description": "Detect whether a terminal supports color",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc