Urara-Blog/node_modules/.pnpm-store/v3/files/0e/ecbb82baeca7af38e39b3f33039f847d2bab5acfe8aa6c680bbb5248f05be25cab898e0933ad08ac10b88425bdaa3890b4ad5b40fa17df05ddef84d398108a
2022-08-14 01:14:53 +08:00

55 lines
1,008 B
Text

import {WriteStream} from 'node:tty';
export interface 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 interface 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;