UNPKG

1.25 kBTypeScriptView Raw
1// Type definitions for supports-color 8.1
2// Project: https://github.com/chalk/supports-color
3// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
4// Matt Traynham <https://github.com/mtraynham>
5// Piotr Błażejewicz <https://github.com/peterblazejewicz>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
8export namespace supportsColor {
9 interface Level {
10 level: number;
11 hasBasic: boolean;
12 has256: boolean;
13 has16m: boolean;
14 }
15
16 interface Options {
17 /**
18 * By default it is `true`, which instructs `supportsColor()` to sniff `process.argv`
19 * for the multitude of `--color` flags (see _Info_ below).
20 * If `false`, then `process.argv` is not considered when determining color support.
21 * @default true
22 */
23 sniffFlags?: boolean | undefined;
24 isTTY?: boolean | undefined;
25 }
26
27 type SupportsColor = false | Level;
28}
29
30export function supportsColor(
31 stream: {
32 isTTY?: boolean | undefined;
33 },
34 options?: supportsColor.Options,
35): supportsColor.SupportsColor;
36
37export const stdout: supportsColor.SupportsColor;
38export const stderr: supportsColor.SupportsColor;