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