UNPKG

2.01 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/supports-color`
3
4# Summary
5This package contains type definitions for supports-color (https://github.com/chalk/supports-color).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supports-color.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supports-color/index.d.ts)
10````ts
11// Type definitions for supports-color 8.1
12// Project: https://github.com/chalk/supports-color
13// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
14// Matt Traynham <https://github.com/mtraynham>
15// Piotr Błażejewicz <https://github.com/peterblazejewicz>
16// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17
18export namespace supportsColor {
19 interface Level {
20 level: number;
21 hasBasic: boolean;
22 has256: boolean;
23 has16m: boolean;
24 }
25
26 interface Options {
27 /**
28 * By default it is `true`, which instructs `supportsColor()` to sniff `process.argv`
29 * for the multitude of `--color` flags (see _Info_ below).
30 * If `false`, then `process.argv` is not considered when determining color support.
31 * @default true
32 */
33 sniffFlags?: boolean | undefined;
34 isTTY?: boolean | undefined;
35 }
36
37 type SupportsColor = false | Level;
38}
39
40export function supportsColor(
41 stream: {
42 isTTY?: boolean | undefined;
43 },
44 options?: supportsColor.Options,
45): supportsColor.SupportsColor;
46
47export const stdout: supportsColor.SupportsColor;
48export const stderr: supportsColor.SupportsColor;
49
50````
51
52### Additional Details
53 * Last updated: Fri, 02 Jul 2021 22:33:11 GMT
54 * Dependencies: none
55 * Global values: none
56
57# Credits
58These definitions were written by [Melvin Groenhoff](https://github.com/mgroenhoff), [Matt Traynham](https://github.com/mtraynham), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
59
\No newline at end of file