1 | // @flow strict
|
---|
2 |
|
---|
3 | type TemplateStringsArray = $ReadOnlyArray<string>;
|
---|
4 |
|
---|
5 | export type Level = $Values<{
|
---|
6 | None: 0,
|
---|
7 | Basic: 1,
|
---|
8 | Ansi256: 2,
|
---|
9 | TrueColor: 3
|
---|
10 | }>;
|
---|
11 |
|
---|
12 | export type ChalkOptions = {|
|
---|
13 | enabled?: boolean,
|
---|
14 | level?: Level
|
---|
15 | |};
|
---|
16 |
|
---|
17 | export type ColorSupport = {|
|
---|
18 | level: Level,
|
---|
19 | hasBasic: boolean,
|
---|
20 | has256: boolean,
|
---|
21 | has16m: boolean
|
---|
22 | |};
|
---|
23 |
|
---|
24 | export interface Chalk {
|
---|
25 | (...text: string[]): string,
|
---|
26 | (text: TemplateStringsArray, ...placeholders: string[]): string,
|
---|
27 | constructor(options?: ChalkOptions): Chalk,
|
---|
28 | enabled: boolean,
|
---|
29 | level: Level,
|
---|
30 | rgb(r: number, g: number, b: number): Chalk,
|
---|
31 | hsl(h: number, s: number, l: number): Chalk,
|
---|
32 | hsv(h: number, s: number, v: number): Chalk,
|
---|
33 | hwb(h: number, w: number, b: number): Chalk,
|
---|
34 | bgHex(color: string): Chalk,
|
---|
35 | bgKeyword(color: string): Chalk,
|
---|
36 | bgRgb(r: number, g: number, b: number): Chalk,
|
---|
37 | bgHsl(h: number, s: number, l: number): Chalk,
|
---|
38 | bgHsv(h: number, s: number, v: number): Chalk,
|
---|
39 | bgHwb(h: number, w: number, b: number): Chalk,
|
---|
40 | hex(color: string): Chalk,
|
---|
41 | keyword(color: string): Chalk,
|
---|
42 |
|
---|
43 | +reset: Chalk,
|
---|
44 | +bold: Chalk,
|
---|
45 | +dim: Chalk,
|
---|
46 | +italic: Chalk,
|
---|
47 | +underline: Chalk,
|
---|
48 | +inverse: Chalk,
|
---|
49 | +hidden: Chalk,
|
---|
50 | +strikethrough: Chalk,
|
---|
51 |
|
---|
52 | +visible: Chalk,
|
---|
53 |
|
---|
54 | +black: Chalk,
|
---|
55 | +red: Chalk,
|
---|
56 | +green: Chalk,
|
---|
57 | +yellow: Chalk,
|
---|
58 | +blue: Chalk,
|
---|
59 | +magenta: Chalk,
|
---|
60 | +cyan: Chalk,
|
---|
61 | +white: Chalk,
|
---|
62 | +gray: Chalk,
|
---|
63 | +grey: Chalk,
|
---|
64 | +blackBright: Chalk,
|
---|
65 | +redBright: Chalk,
|
---|
66 | +greenBright: Chalk,
|
---|
67 | +yellowBright: Chalk,
|
---|
68 | +blueBright: Chalk,
|
---|
69 | +magentaBright: Chalk,
|
---|
70 | +cyanBright: Chalk,
|
---|
71 | +whiteBright: Chalk,
|
---|
72 |
|
---|
73 | +bgBlack: Chalk,
|
---|
74 | +bgRed: Chalk,
|
---|
75 | +bgGreen: Chalk,
|
---|
76 | +bgYellow: Chalk,
|
---|
77 | +bgBlue: Chalk,
|
---|
78 | +bgMagenta: Chalk,
|
---|
79 | +bgCyan: Chalk,
|
---|
80 | +bgWhite: Chalk,
|
---|
81 | +bgBlackBright: Chalk,
|
---|
82 | +bgRedBright: Chalk,
|
---|
83 | +bgGreenBright: Chalk,
|
---|
84 | +bgYellowBright: Chalk,
|
---|
85 | +bgBlueBright: Chalk,
|
---|
86 | +bgMagentaBright: Chalk,
|
---|
87 | +bgCyanBright: Chalk,
|
---|
88 | +bgWhiteBrigh: Chalk,
|
---|
89 |
|
---|
90 | supportsColor: ColorSupport
|
---|
91 | };
|
---|
92 |
|
---|
93 | declare module.exports: Chalk;
|
---|