{"name":"supports-color","version":"10.2.0","keywords":["color","colour","colors","terminal","console","cli","ansi","styles","tty","rgb","256","shell","xterm","command-line","support","supports","capability","detect","truecolor","16m"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"supports-color@10.2.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"qix","email":"npm@josh.junon.me"}],"homepage":"https://github.com/chalk/supports-color#readme","bugs":{"url":"https://github.com/chalk/supports-color/issues"},"ava":{"serial":true,"workerThreads":false},"dist":{"shasum":"4e2ff2704883c99d95ba659ac5e702f06e12e8ed","tarball":"http://registry-npm.ywwl.com/supports-color/download/supports-color-10.2.0.tgz","fileCount":7,"integrity":"sha512-5eG9FQjEjDbAlI5+kdpdyPIBMRH4GfTVDGREVupaZHmVoppknhM29b/S9BkQz7cathp85BVgRi/As3Siln7e0Q==","signatures":[{"sig":"MEUCIBBrdaXn5P5g3wXscv5rHho6YcVtpjDp4I/jAMB2Z5WnAiEAjaDMui63z0HwcZ7mcJN5cWMYSGsZW1oWb62MxM5Bkw0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10717,"size":4364,"noattachment":false,"key":"/supports-color/-/supports-color-10.2.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=18"},"exports":{"node":"./index.js","types":"./index.d.ts","default":"./browser.js"},"funding":"https://github.com/chalk/supports-color?sponsor=1","gitHead":"f6845d63898bd0c96120cfba69fc66a92c48ce03","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/chalk/supports-color.git","type":"git"},"_npmVersion":"10.9.2","description":"Detect whether a terminal supports color","directories":{},"sideEffects":false,"_nodeVersion":"20.19.1","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.60.0","ava":"^6.2.0","tsd":"^0.31.2","@types/node":"^22.10.2"},"_npmOperationalInternal":{"tmp":"tmp/supports-color_10.2.0_1755415736365_0.738929653075078","host":"s3://npm-registry-packages-npm-production"},"readme":"# supports-color\n\n> Detect whether a terminal supports color\n\n## Install\n\n```sh\nnpm install supports-color\n```\n\n## Usage\n\n```js\nimport supportsColor from 'supports-color';\n\nif (supportsColor.stdout) {\n\tconsole.log('Terminal stdout supports color');\n}\n\nif (supportsColor.stdout.has256) {\n\tconsole.log('Terminal stdout supports 256 colors');\n}\n\nif (supportsColor.stderr.has16m) {\n\tconsole.log('Terminal stderr supports 16 million colors (truecolor)');\n}\n```\n\n## API\n\nReturns an `object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.\n\nThe `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:\n\n- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)\n- `.level = 2` and `.has256 = true`: 256 color support\n- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)\n\n### Custom instance\n\nThe package also exposes the named export `createSupportColor` function that takes an arbitrary write stream (for example, `process.stdout`) and an optional options object to (re-)evaluate color support for an arbitrary stream.\n\n```js\nimport {createSupportsColor} from 'supports-color';\n\nconst stdoutSupportsColor = createSupportsColor(process.stdout);\n\nif (stdoutSupportsColor) {\n\tconsole.log('Terminal stdout supports color');\n}\n\n// `stdoutSupportsColor` is the same as `supportsColor.stdout`\n```\n\nThe options object supports a single boolean property `sniffFlags`. By default it is `true`, which instructs the detection to sniff `process.argv` for the multitude of `--color` flags (see _Info_ below). If `false`, then `process.argv` is not considered when determining color support.\n\n## Info\n\nIt obeys the `--color` and `--no-color` CLI flags.\n\nFor 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. A numeric `FORCE_COLOR` overrides the detected color support and sets the level directly, meaning the terminal cannot raise it to a higher level. Use `FORCE_COLOR=true` to instead only enable color and let the level be detected.\n\nExplicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. These take precedence over a non-zero numeric `FORCE_COLOR`.\n\n## Related\n\n- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module\n- [supports-hyperlinks](https://github.com/chalk/supports-hyperlinks) - Detect whether a terminal supports hyperlinks\n- [supports-terminal-graphics](https://github.com/sindresorhus/supports-terminal-graphics) - Detect which terminal graphics protocols are supported\n- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right\n- [is-unicode-supported](https://github.com/sindresorhus/is-unicode-supported) - Detect whether the terminal supports Unicode\n- [is-interactive](https://github.com/sindresorhus/is-interactive) - Check if stdout or stderr is interactive\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Josh Junon](https://github.com/qix-)\n","publish_time":1755415736534,"_cnpm_publish_time":1755415736534,"dist-tags":{"latest":"11.0.0"}}