supports-color
- Version 10.0.0
- Published
- 10.6 kB
- No dependencies
- MIT license
Install
npm i supports-color
yarn add supports-color
pnpm add supports-color
Overview
Detect whether a terminal supports color
Index
Variables
Functions
Type Aliases
Variables
variable supportsColor
const supportsColor: { stdout: ColorInfo; stderr: ColorInfo };
Functions
function createSupportsColor
createSupportsColor: (stream?: WriteStream, options?: Options) => ColorInfo;
Type Aliases
type ColorInfo
type ColorInfo = ColorSupport | false;
type ColorSupport
type ColorSupport = { /** The color level. */ level: ColorSupportLevel;
/** Whether basic 16 colors are supported. */ hasBasic: boolean;
/** Whether ANSI 256 colors are supported. */ has256: boolean;
/** Whether Truecolor 16 million colors are supported. */ has16m: boolean;};
Detect whether the terminal supports color.
type ColorSupportLevel
type ColorSupportLevel = 0 | 1 | 2 | 3;
Levels: -
0
- All colors disabled. -1
- Basic 16 colors support. -2
- ANSI 256 colors support. -3
- Truecolor 16 million colors support.
type Options
type Options = { /** Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.
@default true */ readonly sniffFlags?: boolean;};
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (4)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/supports-color
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/supports-color)
- HTML<a href="https://www.jsdocs.io/package/supports-color"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3272 ms. - Missing or incorrect documentation? Open an issue for this package.