Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supports-color

Package Overview
Dependencies
Maintainers
2
Versions
51
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 9.4.0 to 10.0.0

9

browser.js
/* eslint-env browser */
/* eslint-disable n/no-unsupported-features/node-builtins */
const level = (() => {
if (navigator.userAgentData) {
if (!('navigator' in globalThis)) {
return 0;
}
if (globalThis.navigator.userAgentData) {
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');

@@ -11,3 +16,3 @@ if (brand?.version > 93) {

if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
return 1;

@@ -14,0 +19,0 @@ }

import type {WriteStream} from 'node:tty';
export interface Options {
export type Options = {
/**

@@ -10,3 +10,3 @@ Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.

readonly sniffFlags?: boolean;
}
};

@@ -25,3 +25,3 @@ /**

*/
export interface ColorSupport {
export type ColorSupport = {
/**

@@ -46,3 +46,3 @@ The color level.

has16m: boolean;
}
};

@@ -49,0 +49,0 @@ export type ColorInfo = ColorSupport | false;

@@ -34,13 +34,25 @@ import process from 'node:process';

function envForceColor() {
if ('FORCE_COLOR' in env) {
if (env.FORCE_COLOR === 'true') {
return 1;
}
if (!('FORCE_COLOR' in env)) {
return;
}
if (env.FORCE_COLOR === 'false') {
return 0;
}
if (env.FORCE_COLOR === 'true') {
return 1;
}
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
if (env.FORCE_COLOR === 'false') {
return 0;
}
if (env.FORCE_COLOR.length === 0) {
return 1;
}
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
if (![0, 1, 2, 3].includes(level)) {
return;
}
return level;
}

@@ -116,7 +128,7 @@

if ('CI' in env) {
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
return 3;
}
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
return 1;

@@ -123,0 +135,0 @@ }

{
"name": "supports-color",
"version": "9.4.0",
"version": "10.0.0",
"description": "Detect whether a terminal supports color",

@@ -15,11 +15,12 @@ "license": "MIT",

"exports": {
"types": "./index.d.ts",
"node": "./index.js",
"default": "./browser.js"
},
"sideEffects": false,
"engines": {
"node": ">=12"
"node": ">=18"
},
"scripts": {
"//test": "xo && ava && tsd",
"test": "tsd"
"test": "xo && ava && tsd"
},

@@ -55,8 +56,11 @@ "files": [

"devDependencies": {
"@types/node": "^20.3.2",
"ava": "^5.3.1",
"import-fresh": "^3.3.0",
"tsd": "^0.18.0",
"xo": "^0.54.2"
"@types/node": "^22.10.2",
"ava": "^6.2.0",
"tsd": "^0.31.2",
"xo": "^0.60.0"
},
"ava": {
"serial": true,
"workerThreads": false
}
}

@@ -7,5 +7,5 @@ # supports-color

```sh
npm install supports-color
```
$ npm install supports-color
```

@@ -77,15 +77,1 @@ ## Usage

- [Josh Junon](https://github.com/qix-)
---
<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>
---
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