|
1 |
| -declare namespace ansiStyles { |
2 |
| - interface CSPair { |
3 |
| - /** |
4 |
| - The ANSI terminal control sequence for starting this style. |
5 |
| - */ |
6 |
| - readonly open: string; |
7 |
| - |
8 |
| - /** |
9 |
| - The ANSI terminal control sequence for ending this style. |
10 |
| - */ |
11 |
| - readonly close: string; |
12 |
| - } |
13 |
| - |
14 |
| - interface ColorBase { |
15 |
| - /** |
16 |
| - The ANSI terminal control sequence for ending this color. |
17 |
| - */ |
18 |
| - readonly close: string; |
19 |
| - |
20 |
| - ansi256(code: number): string; |
21 |
| - |
22 |
| - ansi16m(red: number, green: number, blue: number): string; |
23 |
| - } |
24 |
| - |
25 |
| - interface Modifier { |
26 |
| - /** |
27 |
| - Resets the current color chain. |
28 |
| - */ |
29 |
| - readonly reset: CSPair; |
30 |
| - |
31 |
| - /** |
32 |
| - Make text bold. |
33 |
| - */ |
34 |
| - readonly bold: CSPair; |
35 |
| - |
36 |
| - /** |
37 |
| - Emitting only a small amount of light. |
38 |
| - */ |
39 |
| - readonly dim: CSPair; |
40 |
| - |
41 |
| - /** |
42 |
| - Make text italic. (Not widely supported) |
43 |
| - */ |
44 |
| - readonly italic: CSPair; |
45 |
| - |
46 |
| - /** |
47 |
| - Make text underline. (Not widely supported) |
48 |
| - */ |
49 |
| - readonly underline: CSPair; |
50 |
| - |
51 |
| - /** |
52 |
| - Make text overline. |
53 |
| -
|
54 |
| - Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. |
55 |
| - */ |
56 |
| - readonly overline: CSPair; |
57 |
| - |
58 |
| - /** |
59 |
| - Inverse background and foreground colors. |
60 |
| - */ |
61 |
| - readonly inverse: CSPair; |
62 |
| - |
63 |
| - /** |
64 |
| - Prints the text, but makes it invisible. |
65 |
| - */ |
66 |
| - readonly hidden: CSPair; |
67 |
| - |
68 |
| - /** |
69 |
| - Puts a horizontal line through the center of the text. (Not widely supported) |
70 |
| - */ |
71 |
| - readonly strikethrough: CSPair; |
72 |
| - } |
73 |
| - |
74 |
| - interface ForegroundColor { |
75 |
| - readonly black: CSPair; |
76 |
| - readonly red: CSPair; |
77 |
| - readonly green: CSPair; |
78 |
| - readonly yellow: CSPair; |
79 |
| - readonly blue: CSPair; |
80 |
| - readonly cyan: CSPair; |
81 |
| - readonly magenta: CSPair; |
82 |
| - readonly white: CSPair; |
83 |
| - |
84 |
| - /** |
85 |
| - Alias for `blackBright`. |
86 |
| - */ |
87 |
| - readonly gray: CSPair; |
88 |
| - |
89 |
| - /** |
90 |
| - Alias for `blackBright`. |
91 |
| - */ |
92 |
| - readonly grey: CSPair; |
93 |
| - |
94 |
| - readonly blackBright: CSPair; |
95 |
| - readonly redBright: CSPair; |
96 |
| - readonly greenBright: CSPair; |
97 |
| - readonly yellowBright: CSPair; |
98 |
| - readonly blueBright: CSPair; |
99 |
| - readonly cyanBright: CSPair; |
100 |
| - readonly magentaBright: CSPair; |
101 |
| - readonly whiteBright: CSPair; |
102 |
| - } |
103 |
| - |
104 |
| - interface BackgroundColor { |
105 |
| - readonly bgBlack: CSPair; |
106 |
| - readonly bgRed: CSPair; |
107 |
| - readonly bgGreen: CSPair; |
108 |
| - readonly bgYellow: CSPair; |
109 |
| - readonly bgBlue: CSPair; |
110 |
| - readonly bgCyan: CSPair; |
111 |
| - readonly bgMagenta: CSPair; |
112 |
| - readonly bgWhite: CSPair; |
113 |
| - |
114 |
| - /** |
115 |
| - Alias for `bgBlackBright`. |
116 |
| - */ |
117 |
| - readonly bgGray: CSPair; |
118 |
| - |
119 |
| - /** |
120 |
| - Alias for `bgBlackBright`. |
121 |
| - */ |
122 |
| - readonly bgGrey: CSPair; |
123 |
| - |
124 |
| - readonly bgBlackBright: CSPair; |
125 |
| - readonly bgRedBright: CSPair; |
126 |
| - readonly bgGreenBright: CSPair; |
127 |
| - readonly bgYellowBright: CSPair; |
128 |
| - readonly bgBlueBright: CSPair; |
129 |
| - readonly bgCyanBright: CSPair; |
130 |
| - readonly bgMagentaBright: CSPair; |
131 |
| - readonly bgWhiteBright: CSPair; |
132 |
| - } |
133 |
| - |
134 |
| - interface ConvertColor { |
135 |
| - /** |
136 |
| - Convert from the RGB color space to the ANSI 256 color space. |
137 |
| -
|
138 |
| - @param red - (`0...255`) |
139 |
| - @param green - (`0...255`) |
140 |
| - @param blue - (`0...255`) |
141 |
| - */ |
142 |
| - rgbToAnsi256(red: number, green: number, blue: number): number; |
143 |
| - |
144 |
| - /** |
145 |
| - Convert from the RGB HEX color space to the RGB color space. |
146 |
| -
|
147 |
| - @param hex - A hexadecimal string containing RGB data. |
148 |
| - */ |
149 |
| - hexToRgb(hex: string): [red: number, green: number, blue: number]; |
150 |
| - |
151 |
| - /** |
152 |
| - Convert from the RGB HEX color space to the ANSI 256 color space. |
153 |
| -
|
154 |
| - @param hex - A hexadecimal string containing RGB data. |
155 |
| - */ |
156 |
| - hexToAnsi256(hex: string): number; |
157 |
| - } |
| 1 | +export interface CSPair { |
| 2 | + /** |
| 3 | + The ANSI terminal control sequence for starting this style. |
| 4 | + */ |
| 5 | + readonly open: string; |
| 6 | + |
| 7 | + /** |
| 8 | + The ANSI terminal control sequence for ending this style. |
| 9 | + */ |
| 10 | + readonly close: string; |
| 11 | +} |
| 12 | + |
| 13 | +export interface ColorBase { |
| 14 | + /** |
| 15 | + The ANSI terminal control sequence for ending this color. |
| 16 | + */ |
| 17 | + readonly close: string; |
| 18 | + |
| 19 | + ansi256(code: number): string; |
| 20 | + |
| 21 | + ansi16m(red: number, green: number, blue: number): string; |
| 22 | +} |
| 23 | + |
| 24 | +export interface Modifier { |
| 25 | + /** |
| 26 | + Resets the current color chain. |
| 27 | + */ |
| 28 | + readonly reset: CSPair; |
| 29 | + |
| 30 | + /** |
| 31 | + Make text bold. |
| 32 | + */ |
| 33 | + readonly bold: CSPair; |
| 34 | + |
| 35 | + /** |
| 36 | + Emitting only a small amount of light. |
| 37 | + */ |
| 38 | + readonly dim: CSPair; |
| 39 | + |
| 40 | + /** |
| 41 | + Make text italic. (Not widely supported) |
| 42 | + */ |
| 43 | + readonly italic: CSPair; |
| 44 | + |
| 45 | + /** |
| 46 | + Make text underline. (Not widely supported) |
| 47 | + */ |
| 48 | + readonly underline: CSPair; |
| 49 | + |
| 50 | + /** |
| 51 | + Make text overline. |
| 52 | +
|
| 53 | + Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. |
| 54 | + */ |
| 55 | + readonly overline: CSPair; |
| 56 | + |
| 57 | + /** |
| 58 | + Inverse background and foreground colors. |
| 59 | + */ |
| 60 | + readonly inverse: CSPair; |
| 61 | + |
| 62 | + /** |
| 63 | + Prints the text, but makes it invisible. |
| 64 | + */ |
| 65 | + readonly hidden: CSPair; |
| 66 | + |
| 67 | + /** |
| 68 | + Puts a horizontal line through the center of the text. (Not widely supported) |
| 69 | + */ |
| 70 | + readonly strikethrough: CSPair; |
| 71 | +} |
| 72 | + |
| 73 | +export interface ForegroundColor { |
| 74 | + readonly black: CSPair; |
| 75 | + readonly red: CSPair; |
| 76 | + readonly green: CSPair; |
| 77 | + readonly yellow: CSPair; |
| 78 | + readonly blue: CSPair; |
| 79 | + readonly cyan: CSPair; |
| 80 | + readonly magenta: CSPair; |
| 81 | + readonly white: CSPair; |
| 82 | + |
| 83 | + /** |
| 84 | + Alias for `blackBright`. |
| 85 | + */ |
| 86 | + readonly gray: CSPair; |
| 87 | + |
| 88 | + /** |
| 89 | + Alias for `blackBright`. |
| 90 | + */ |
| 91 | + readonly grey: CSPair; |
| 92 | + |
| 93 | + readonly blackBright: CSPair; |
| 94 | + readonly redBright: CSPair; |
| 95 | + readonly greenBright: CSPair; |
| 96 | + readonly yellowBright: CSPair; |
| 97 | + readonly blueBright: CSPair; |
| 98 | + readonly cyanBright: CSPair; |
| 99 | + readonly magentaBright: CSPair; |
| 100 | + readonly whiteBright: CSPair; |
| 101 | +} |
| 102 | + |
| 103 | +export interface BackgroundColor { |
| 104 | + readonly bgBlack: CSPair; |
| 105 | + readonly bgRed: CSPair; |
| 106 | + readonly bgGreen: CSPair; |
| 107 | + readonly bgYellow: CSPair; |
| 108 | + readonly bgBlue: CSPair; |
| 109 | + readonly bgCyan: CSPair; |
| 110 | + readonly bgMagenta: CSPair; |
| 111 | + readonly bgWhite: CSPair; |
| 112 | + |
| 113 | + /** |
| 114 | + Alias for `bgBlackBright`. |
| 115 | + */ |
| 116 | + readonly bgGray: CSPair; |
| 117 | + |
| 118 | + /** |
| 119 | + Alias for `bgBlackBright`. |
| 120 | + */ |
| 121 | + readonly bgGrey: CSPair; |
| 122 | + |
| 123 | + readonly bgBlackBright: CSPair; |
| 124 | + readonly bgRedBright: CSPair; |
| 125 | + readonly bgGreenBright: CSPair; |
| 126 | + readonly bgYellowBright: CSPair; |
| 127 | + readonly bgBlueBright: CSPair; |
| 128 | + readonly bgCyanBright: CSPair; |
| 129 | + readonly bgMagentaBright: CSPair; |
| 130 | + readonly bgWhiteBright: CSPair; |
| 131 | +} |
| 132 | + |
| 133 | +export interface ConvertColor { |
| 134 | + /** |
| 135 | + Convert from the RGB color space to the ANSI 256 color space. |
| 136 | +
|
| 137 | + @param red - (`0...255`) |
| 138 | + @param green - (`0...255`) |
| 139 | + @param blue - (`0...255`) |
| 140 | + */ |
| 141 | + rgbToAnsi256(red: number, green: number, blue: number): number; |
| 142 | + |
| 143 | + /** |
| 144 | + Convert from the RGB HEX color space to the RGB color space. |
| 145 | +
|
| 146 | + @param hex - A hexadecimal string containing RGB data. |
| 147 | + */ |
| 148 | + hexToRgb(hex: string): [red: number, green: number, blue: number]; |
| 149 | + |
| 150 | + /** |
| 151 | + Convert from the RGB HEX color space to the ANSI 256 color space. |
| 152 | +
|
| 153 | + @param hex - A hexadecimal string containing RGB data. |
| 154 | + */ |
| 155 | + hexToAnsi256(hex: string): number; |
158 | 156 | }
|
159 | 157 |
|
160 | 158 | declare const ansiStyles: {
|
161 |
| - readonly modifier: ansiStyles.Modifier; |
162 |
| - readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; |
163 |
| - readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; |
| 159 | + readonly modifier: Modifier; |
| 160 | + readonly color: ColorBase & ForegroundColor; |
| 161 | + readonly bgColor: ColorBase & BackgroundColor; |
164 | 162 | readonly codes: ReadonlyMap<number, number>;
|
165 |
| -} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier & ansiStyles.ConvertColor; |
| 163 | +} & ForegroundColor & BackgroundColor & Modifier & ConvertColor; |
166 | 164 |
|
167 |
| -export = ansiStyles; |
| 165 | +export default ansiStyles; |
0 commit comments