/** Basic foreground colors. [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) */ export type ForegroundColor = | 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright'; /** Basic background colors. [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) */ export type BackgroundColor = | 'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' | 'bgGray' | 'bgGrey' | 'bgBlackBright' | 'bgRedBright' | 'bgGreenBright' | 'bgYellowBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright'; /** Basic colors. [More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) */ export type Color = ForegroundColor | BackgroundColor; export type Modifiers = | 'reset' | 'bold' | 'dim' | 'italic' | 'underline' | 'inverse' | 'hidden' | 'strikethrough' | 'visible'; /** 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; export interface Options { /** Specify the color support for Chalk. By default, color support is automatically detected based on the environment. Levels: - `0` - All colors disabled. - `1` - Basic 16 colors support. - `2` - ANSI 256 colors support. - `3` - Truecolor 16 million colors support. */ readonly level?: ColorSupportLevel; } /** Return a new Chalk instance. */ export type ChalkClass = new (options?: Options) => ChalkInstance; /** Detect whether the terminal supports color. */ export interface ColorSupport { /** The color level used by Chalk. */ level: ColorSupportLevel; /** Return whether Chalk supports basic 16 colors. */ hasBasic: boolean; /** Return whether Chalk supports ANSI 256 colors. */ has256: boolean; /** Return whether Chalk supports Truecolor 16 million colors. */ has16m: boolean; } interface ChalkFunction { /** Use a template string. @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) @example ``` import chalk from 'chalk'; log(chalk` CPU: {red ${cpu.totalPercent}%} RAM: {green ${ram.used / ram.total * 100}%} DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} `); ``` @example ``` import chalk from 'chalk'; log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`) ``` */ (text: TemplateStringsArray, ...placeholders: unknown[]): string; (...text: unknown[]): string; } export interface ChalkInstance extends ChalkFunction { /** Return a new Chalk instance. */ Chalk: ChalkClass; /** The color support for Chalk. By default, color support is automatically detected based on the environment. Levels: - `0` - All colors disabled. - `1` - Basic 16 colors support. - `2` - ANSI 256 colors support. - `3` - Truecolor 16 million colors support. */ level: ColorSupportLevel; /** Use HEX value to set text color. @param color - Hexadecimal value representing the desired color. @example ``` import chalk from 'chalk'; chalk.hex('#DEADED'); ``` */ hex: (color: string) => ChalkInstance; /** Use keyword color value to set text color. @param color - Keyword value representing the desired color. @example ``` import chalk from 'chalk'; chalk.keyword('orange'); ``` */ keyword: (color: string) => ChalkInstance; /** Use RGB values to set text color. */ rgb: (red: number, green: number, blue: number) => ChalkInstance; /** Use HSL values to set text color. */ hsl: (hue: number, saturation: number, lightness: number) => ChalkInstance; /** Use HSV values to set text color. */ hsv: (hue: number, saturation: number, value: number) => ChalkInstance; /** Use HWB values to set text color. */ hwb: (hue: number, whiteness: number, blackness: number) => ChalkInstance; /** Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. 30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright. */ ansi: (code: number) => ChalkInstance; /** Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. */ ansi256: (index: number) => ChalkInstance; /** Use HEX value to set background color. @param color - Hexadecimal value representing the desired color. @example ``` import chalk from 'chalk'; chalk.bgHex('#DEADED'); ``` */ bgHex: (color: string) => ChalkInstance; /** Use keyword color value to set background color. @param color - Keyword value representing the desired color. @example ``` import chalk from 'chalk'; chalk.bgKeyword('orange'); ``` */ bgKeyword: (color: string) => ChalkInstance; /** Use RGB values to set background color. */ bgRgb: (red: number, green: number, blue: number) => ChalkInstance; /** Use HSL values to set background color. */ bgHsl: (hue: number, saturation: number, lightness: number) => ChalkInstance; /** Use HSV values to set background color. */ bgHsv: (hue: number, saturation: number, value: number) => ChalkInstance; /** Use HWB values to set background color. */ bgHwb: (hue: number, whiteness: number, blackness: number) => ChalkInstance; /** Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. 30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright. Use the foreground code, not the background code (for example, not 41, nor 101). */ bgAnsi: (code: number) => ChalkInstance; /** Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. */ bgAnsi256: (index: number) => ChalkInstance; /** Modifier: Resets the current color chain. */ readonly reset: ChalkInstance; /** Modifier: Make text bold. */ readonly bold: ChalkInstance; /** Modifier: Emitting only a small amount of light. */ readonly dim: ChalkInstance; /** Modifier: Make text italic. (Not widely supported) */ readonly italic: ChalkInstance; /** Modifier: Make text underline. (Not widely supported) */ readonly underline: ChalkInstance; /** Modifier: Inverse background and foreground colors. */ readonly inverse: ChalkInstance; /** Modifier: Prints the text, but makes it invisible. */ readonly hidden: ChalkInstance; /** Modifier: Puts a horizontal line through the center of the text. (Not widely supported) */ readonly strikethrough: ChalkInstance; /** Modifier: Prints the text only when Chalk has a color support level > 0. Can be useful for things that are purely cosmetic. */ readonly visible: ChalkInstance; readonly black: ChalkInstance; readonly red: ChalkInstance; readonly green: ChalkInstance; readonly yellow: ChalkInstance; readonly blue: ChalkInstance; readonly magenta: ChalkInstance; readonly cyan: ChalkInstance; readonly white: ChalkInstance; /* Alias for `blackBright`. */ readonly gray: ChalkInstance; /* Alias for `blackBright`. */ readonly grey: ChalkInstance; readonly blackBright: ChalkInstance; readonly redBright: ChalkInstance; readonly greenBright: ChalkInstance; readonly yellowBright: ChalkInstance; readonly blueBright: ChalkInstance; readonly magentaBright: ChalkInstance; readonly cyanBright: ChalkInstance; readonly whiteBright: ChalkInstance; readonly bgBlack: ChalkInstance; readonly bgRed: ChalkInstance; readonly bgGreen: ChalkInstance; readonly bgYellow: ChalkInstance; readonly bgBlue: ChalkInstance; readonly bgMagenta: ChalkInstance; readonly bgCyan: ChalkInstance; readonly bgWhite: ChalkInstance; /* Alias for `bgBlackBright`. */ readonly bgGray: ChalkInstance; /* Alias for `bgBlackBright`. */ readonly bgGrey: ChalkInstance; readonly bgBlackBright: ChalkInstance; readonly bgRedBright: ChalkInstance; readonly bgGreenBright: ChalkInstance; readonly bgYellowBright: ChalkInstance; readonly bgBlueBright: ChalkInstance; readonly bgMagentaBright: ChalkInstance; readonly bgCyanBright: ChalkInstance; readonly bgWhiteBright: ChalkInstance; } /** Main Chalk object that allows to chain styles together. Call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. */ declare const chalk: ChalkInstance & ChalkFunction; declare const supportsColor: ColorSupport | false; declare const chalkStderr: ChalkInstance & {supportsColor: ColorSupport | false}; declare const Chalk: ChalkClass; export { supportsColor, chalkStderr, Chalk }; export default chalk;