132 lines
2.5 KiB
Text
132 lines
2.5 KiB
Text
// @flow strict
|
|
|
|
type TemplateStringsArray = $ReadOnlyArray<string>;
|
|
|
|
export type Level = $Values<{
|
|
None: 0,
|
|
Basic: 1,
|
|
Ansi256: 2,
|
|
TrueColor: 3
|
|
}>;
|
|
|
|
export type Options = {|
|
|
enabled?: boolean,
|
|
level?: Level
|
|
|};
|
|
|
|
export type ColorSupport = {|
|
|
level: Level,
|
|
hasBasic: boolean,
|
|
has256: boolean,
|
|
has16m: boolean
|
|
|};
|
|
|
|
/**
|
|
* Available colors for use
|
|
*/
|
|
export type Color =
|
|
"black"
|
|
| "red"
|
|
| "green"
|
|
| "yellow"
|
|
| "blue"
|
|
| "magenta"
|
|
| "cyan"
|
|
| "white"
|
|
| "gray"
|
|
| "grey"
|
|
| "blackBright"
|
|
| "redBright"
|
|
| "greenBright"
|
|
| "yellowBright"
|
|
| "blueBright"
|
|
| "magentaBright"
|
|
| "cyanBright"
|
|
| "whiteBright"
|
|
| "bgBlack"
|
|
| "bgRed"
|
|
| "bgGreen"
|
|
| "bgYellow"
|
|
| "bgBlue"
|
|
| "bgMagenta"
|
|
| "bgCyan"
|
|
| "bgWhite"
|
|
| "bgBlackBright"
|
|
| "bgRedBright"
|
|
| "bgGreenBright"
|
|
| "bgYellowBright"
|
|
| "bgBlueBright"
|
|
| "bgMagentaBright"
|
|
| "bgCyanBright"
|
|
| "bgWhiteBright";
|
|
|
|
export interface Chalk {
|
|
(...text: string[]): string,
|
|
(text: TemplateStringsArray, ...placeholders: mixed[]): string,
|
|
Instance(options?: Options): Chalk,
|
|
enabled: boolean,
|
|
level: Level,
|
|
rgb(red: number, green: number, blue: number): Chalk,
|
|
hsl(hue: number, saturation: number, lightness: number): Chalk,
|
|
hsv(hue: number, saturation: number, value: number): Chalk,
|
|
hwb(hue: number, whiteness: number, blackness: number): Chalk,
|
|
bgHex(color: string): Chalk,
|
|
bgKeyword(color: string): Chalk,
|
|
bgRgb(red: number, green: number, blue: number): Chalk,
|
|
bgHsl(hue: number, saturation: number, lightness: number): Chalk,
|
|
bgHsv(hue: number, saturation: number, value: number): Chalk,
|
|
bgHwb(hue: number, whiteness: number, blackness: number): Chalk,
|
|
hex(color: string): Chalk,
|
|
keyword(color: string): Chalk,
|
|
|
|
+reset: Chalk,
|
|
+bold: Chalk,
|
|
+dim: Chalk,
|
|
+italic: Chalk,
|
|
+underline: Chalk,
|
|
+inverse: Chalk,
|
|
+hidden: Chalk,
|
|
+strikethrough: Chalk,
|
|
|
|
+visible: Chalk,
|
|
|
|
+black: Chalk,
|
|
+red: Chalk,
|
|
+green: Chalk,
|
|
+yellow: Chalk,
|
|
+blue: Chalk,
|
|
+magenta: Chalk,
|
|
+cyan: Chalk,
|
|
+white: Chalk,
|
|
+gray: Chalk,
|
|
+grey: Chalk,
|
|
+blackBright: Chalk,
|
|
+redBright: Chalk,
|
|
+greenBright: Chalk,
|
|
+yellowBright: Chalk,
|
|
+blueBright: Chalk,
|
|
+magentaBright: Chalk,
|
|
+cyanBright: Chalk,
|
|
+whiteBright: Chalk,
|
|
|
|
+bgBlack: Chalk,
|
|
+bgRed: Chalk,
|
|
+bgGreen: Chalk,
|
|
+bgYellow: Chalk,
|
|
+bgBlue: Chalk,
|
|
+bgMagenta: Chalk,
|
|
+bgCyan: Chalk,
|
|
+bgWhite: Chalk,
|
|
+bgBlackBright: Chalk,
|
|
+bgRedBright: Chalk,
|
|
+bgGreenBright: Chalk,
|
|
+bgYellowBright: Chalk,
|
|
+bgBlueBright: Chalk,
|
|
+bgMagentaBright: Chalk,
|
|
+bgCyanBright: Chalk,
|
|
+bgWhiteBright: Chalk,
|
|
|
|
supportsColor: ColorSupport
|
|
};
|
|
|
|
declare module.exports: Chalk;
|