Sha256: f61a4dc92450609c353738f0a2daebf8cae71b24716dbd952456d80b1e1a48b6

Contents?: true

Size: 1010 Bytes

Versions: 50

Compression:

Stored size: 1010 Bytes

Contents

import type {WriteStream} from 'node:tty';

export type Options = {
	/**
	Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.

	@default true
	*/
	readonly sniffFlags?: boolean;
};

/**
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
export type ColorSupportLevel = 0 | 1 | 2 | 3;

/**
Detect whether the terminal supports color.
*/
export 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;
};

export type ColorInfo = ColorSupport | false;

export function createSupportsColor(stream?: WriteStream, options?: Options): ColorInfo;

declare const supportsColor: {
	stdout: ColorInfo;
	stderr: ColorInfo;
};

export default supportsColor;

Version data entries

50 entries across 26 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.51 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.50 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.50 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.49 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.49 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.48 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.48 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.47 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.47 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.46 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.46 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
pcp-server-ruby-sdk-0.0.6 node_modules/chalk/source/vendor/supports-color/index.d.ts
pcp-server-ruby-sdk-0.1.0 node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.45 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.45 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.44 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.44 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.43 node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.d.ts
immosquare-cleaner-0.1.43 node_modules/boxen/node_modules/chalk/source/vendor/supports-color/index.d.ts