1 import * as cssColors from 'color-name';
3 declare namespace ansiStyles {
4 interface ColorConvert {
8 @param red - (`0`-`255`)
9 @param green - (`0`-`255`)
10 @param blue - (`0`-`255`)
12 rgb(red: number, green: number, blue: number): string;
15 The RGB HEX color space.
17 @param hex - A hexadecimal string containing RGB data.
19 hex(hex: string): string;
22 @param keyword - A CSS color name.
24 keyword(keyword: keyof typeof cssColors): string;
29 @param hue - (`0`-`360`)
30 @param saturation - (`0`-`100`)
31 @param lightness - (`0`-`100`)
33 hsl(hue: number, saturation: number, lightness: number): string;
38 @param hue - (`0`-`360`)
39 @param saturation - (`0`-`100`)
40 @param value - (`0`-`100`)
42 hsv(hue: number, saturation: number, value: number): string;
47 @param hue - (`0`-`360`)
48 @param whiteness - (`0`-`100`)
49 @param blackness - (`0`-`100`)
51 hwb(hue: number, whiteness: number, blackness: number): string;
54 Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
56 ansi(ansi: number): string;
59 Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
61 ansi256(ansi: number): string;
66 The ANSI terminal control sequence for starting this style.
68 readonly open: string;
71 The ANSI terminal control sequence for ending this style.
73 readonly close: string;
77 readonly ansi: ColorConvert;
78 readonly ansi256: ColorConvert;
79 readonly ansi16m: ColorConvert;
82 The ANSI terminal control sequence for ending this color.
84 readonly close: string;
89 Resets the current color chain.
91 readonly reset: CSPair;
96 readonly bold: CSPair;
99 Emitting only a small amount of light.
101 readonly dim: CSPair;
104 Make text italic. (Not widely supported)
106 readonly italic: CSPair;
109 Make text underline. (Not widely supported)
111 readonly underline: CSPair;
114 Inverse background and foreground colors.
116 readonly inverse: CSPair;
119 Prints the text, but makes it invisible.
121 readonly hidden: CSPair;
124 Puts a horizontal line through the center of the text. (Not widely supported)
126 readonly strikethrough: CSPair;
129 interface ForegroundColor {
130 readonly black: CSPair;
131 readonly red: CSPair;
132 readonly green: CSPair;
133 readonly yellow: CSPair;
134 readonly blue: CSPair;
135 readonly cyan: CSPair;
136 readonly magenta: CSPair;
137 readonly white: CSPair;
140 Alias for `blackBright`.
142 readonly gray: CSPair;
145 Alias for `blackBright`.
147 readonly grey: CSPair;
149 readonly blackBright: CSPair;
150 readonly redBright: CSPair;
151 readonly greenBright: CSPair;
152 readonly yellowBright: CSPair;
153 readonly blueBright: CSPair;
154 readonly cyanBright: CSPair;
155 readonly magentaBright: CSPair;
156 readonly whiteBright: CSPair;
159 interface BackgroundColor {
160 readonly bgBlack: CSPair;
161 readonly bgRed: CSPair;
162 readonly bgGreen: CSPair;
163 readonly bgYellow: CSPair;
164 readonly bgBlue: CSPair;
165 readonly bgCyan: CSPair;
166 readonly bgMagenta: CSPair;
167 readonly bgWhite: CSPair;
170 Alias for `bgBlackBright`.
172 readonly bgGray: CSPair;
175 Alias for `bgBlackBright`.
177 readonly bgGrey: CSPair;
179 readonly bgBlackBright: CSPair;
180 readonly bgRedBright: CSPair;
181 readonly bgGreenBright: CSPair;
182 readonly bgYellowBright: CSPair;
183 readonly bgBlueBright: CSPair;
184 readonly bgCyanBright: CSPair;
185 readonly bgMagentaBright: CSPair;
186 readonly bgWhiteBright: CSPair;
190 declare const ansiStyles: {
191 readonly modifier: ansiStyles.Modifier;
192 readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
193 readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
194 readonly codes: ReadonlyMap<number, number>;
195 } & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;