1 | export interface CSPair {
|
2 | |
3 |
|
4 |
|
5 | readonly open: string;
|
6 |
|
7 | |
8 |
|
9 |
|
10 | readonly close: string;
|
11 | }
|
12 |
|
13 | export interface ColorBase {
|
14 | |
15 |
|
16 |
|
17 | readonly close: string;
|
18 |
|
19 | ansi(code: number): string;
|
20 |
|
21 | ansi256(code: number): string;
|
22 |
|
23 | ansi16m(red: number, green: number, blue: number): string;
|
24 | }
|
25 |
|
26 | export interface Modifier {
|
27 | |
28 |
|
29 |
|
30 | readonly reset: CSPair;
|
31 |
|
32 | |
33 |
|
34 |
|
35 | readonly bold: CSPair;
|
36 |
|
37 | |
38 |
|
39 |
|
40 | readonly dim: CSPair;
|
41 |
|
42 | |
43 |
|
44 |
|
45 | readonly italic: CSPair;
|
46 |
|
47 | |
48 |
|
49 |
|
50 | readonly underline: CSPair;
|
51 |
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 | readonly overline: CSPair;
|
58 |
|
59 | |
60 |
|
61 |
|
62 | readonly inverse: CSPair;
|
63 |
|
64 | |
65 |
|
66 |
|
67 | readonly hidden: CSPair;
|
68 |
|
69 | |
70 |
|
71 |
|
72 | readonly strikethrough: CSPair;
|
73 | }
|
74 |
|
75 | export interface ForegroundColor {
|
76 | readonly black: CSPair;
|
77 | readonly red: CSPair;
|
78 | readonly green: CSPair;
|
79 | readonly yellow: CSPair;
|
80 | readonly blue: CSPair;
|
81 | readonly cyan: CSPair;
|
82 | readonly magenta: CSPair;
|
83 | readonly white: CSPair;
|
84 |
|
85 | |
86 |
|
87 |
|
88 | readonly gray: CSPair;
|
89 |
|
90 | |
91 |
|
92 |
|
93 | readonly grey: CSPair;
|
94 |
|
95 | readonly blackBright: CSPair;
|
96 | readonly redBright: CSPair;
|
97 | readonly greenBright: CSPair;
|
98 | readonly yellowBright: CSPair;
|
99 | readonly blueBright: CSPair;
|
100 | readonly cyanBright: CSPair;
|
101 | readonly magentaBright: CSPair;
|
102 | readonly whiteBright: CSPair;
|
103 | }
|
104 |
|
105 | export interface BackgroundColor {
|
106 | readonly bgBlack: CSPair;
|
107 | readonly bgRed: CSPair;
|
108 | readonly bgGreen: CSPair;
|
109 | readonly bgYellow: CSPair;
|
110 | readonly bgBlue: CSPair;
|
111 | readonly bgCyan: CSPair;
|
112 | readonly bgMagenta: CSPair;
|
113 | readonly bgWhite: CSPair;
|
114 |
|
115 | |
116 |
|
117 |
|
118 | readonly bgGray: CSPair;
|
119 |
|
120 | |
121 |
|
122 |
|
123 | readonly bgGrey: CSPair;
|
124 |
|
125 | readonly bgBlackBright: CSPair;
|
126 | readonly bgRedBright: CSPair;
|
127 | readonly bgGreenBright: CSPair;
|
128 | readonly bgYellowBright: CSPair;
|
129 | readonly bgBlueBright: CSPair;
|
130 | readonly bgCyanBright: CSPair;
|
131 | readonly bgMagentaBright: CSPair;
|
132 | readonly bgWhiteBright: CSPair;
|
133 | }
|
134 |
|
135 | export interface ConvertColor {
|
136 | |
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 | rgbToAnsi256(red: number, green: number, blue: number): number;
|
144 |
|
145 | |
146 |
|
147 |
|
148 |
|
149 |
|
150 | hexToRgb(hex: string): [red: number, green: number, blue: number];
|
151 |
|
152 | |
153 |
|
154 |
|
155 |
|
156 |
|
157 | hexToAnsi256(hex: string): number;
|
158 |
|
159 | |
160 |
|
161 |
|
162 |
|
163 |
|
164 | ansi256ToAnsi(code: number): number;
|
165 |
|
166 | |
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 | rgbToAnsi(red: number, green: number, blue: number): number;
|
174 |
|
175 | |
176 |
|
177 |
|
178 |
|
179 |
|
180 | hexToAnsi(hex: string): number;
|
181 | }
|
182 |
|
183 |
|
184 |
|
185 |
|
186 | export type ModifierName = keyof Modifier;
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | export type ForegroundColorName = keyof ForegroundColor;
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | export type BackgroundColorName = keyof BackgroundColor;
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 | export type ColorName = ForegroundColorName | BackgroundColorName;
|
208 |
|
209 |
|
210 |
|
211 |
|
212 | export const modifierNames: readonly ModifierName[];
|
213 |
|
214 |
|
215 |
|
216 |
|
217 | export const foregroundColorNames: readonly ForegroundColorName[];
|
218 |
|
219 |
|
220 |
|
221 |
|
222 | export const backgroundColorNames: readonly BackgroundColorName[];
|
223 |
|
224 |
|
225 |
|
226 |
|
227 | export const colorNames: readonly ColorName[];
|
228 |
|
229 | declare const ansiStyles: {
|
230 | readonly modifier: Modifier;
|
231 | readonly color: ColorBase & ForegroundColor;
|
232 | readonly bgColor: ColorBase & BackgroundColor;
|
233 | readonly codes: ReadonlyMap<number, number>;
|
234 | } & ForegroundColor & BackgroundColor & Modifier & ConvertColor;
|
235 |
|
236 | export default ansiStyles;
|