textual-tty 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- textual_tty/__init__.py +0 -0
- textual_tty/__main__.py +6 -0
- textual_tty/color.py +643 -0
- textual_tty/demo.py +167 -0
- textual_tty/log.py +64 -0
- textual_tty/parser.py +909 -0
- textual_tty/pty_handler.py +260 -0
- textual_tty/screen.py +437 -0
- textual_tty/tcaps.py +123 -0
- textual_tty/widgets/__init__.py +8 -0
- textual_tty/widgets/debug_log.py +146 -0
- textual_tty/widgets/program.py +131 -0
- textual_tty/widgets/program_window.py +119 -0
- textual_tty/widgets/terminal.py +331 -0
- textual_tty-0.0.2.dist-info/METADATA +60 -0
- textual_tty-0.0.2.dist-info/RECORD +19 -0
- textual_tty-0.0.2.dist-info/WHEEL +4 -0
- textual_tty-0.0.2.dist-info/entry_points.txt +3 -0
- textual_tty-0.0.2.dist-info/licenses/LICENSE.md +7 -0
textual_tty/__init__.py
ADDED
|
File without changes
|
textual_tty/__main__.py
ADDED
textual_tty/color.py
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
"""Color handling for terminal emulator - parsing and palette management."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional, Tuple
|
|
6
|
+
from textual.color import Color
|
|
7
|
+
from rich.color import Color as RichColor
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# X11 color names mapped to hex codes (tmux compatibility)
|
|
11
|
+
X11_NAMES = {
|
|
12
|
+
"AliceBlue": "#f0f8ff",
|
|
13
|
+
"AntiqueWhite": "#faebd7",
|
|
14
|
+
"AntiqueWhite1": "#ffefdb",
|
|
15
|
+
"AntiqueWhite2": "#eedfcc",
|
|
16
|
+
"AntiqueWhite3": "#cdc0b0",
|
|
17
|
+
"AntiqueWhite4": "#8b8378",
|
|
18
|
+
"BlanchedAlmond": "#ffebcd",
|
|
19
|
+
"BlueViolet": "#8a2be2",
|
|
20
|
+
"CadetBlue": "#5f9ea0",
|
|
21
|
+
"CadetBlue1": "#98f5ff",
|
|
22
|
+
"CadetBlue2": "#8ee5ee",
|
|
23
|
+
"CadetBlue3": "#7ac5cd",
|
|
24
|
+
"CadetBlue4": "#53868b",
|
|
25
|
+
"CornflowerBlue": "#6495ed",
|
|
26
|
+
"DarkBlue": "#00008b",
|
|
27
|
+
"DarkCyan": "#008b8b",
|
|
28
|
+
"DarkGoldenrod": "#b8860b",
|
|
29
|
+
"DarkGoldenrod1": "#ffb90f",
|
|
30
|
+
"DarkGoldenrod2": "#eead0e",
|
|
31
|
+
"DarkGoldenrod3": "#cd950c",
|
|
32
|
+
"DarkGoldenrod4": "#8b6508",
|
|
33
|
+
"DarkGray": "#a9a9a9",
|
|
34
|
+
"DarkGreen": "#006400",
|
|
35
|
+
"DarkGrey": "#a9a9a9",
|
|
36
|
+
"DarkKhaki": "#bdb76b",
|
|
37
|
+
"DarkMagenta": "#8b008b",
|
|
38
|
+
"DarkOliveGreen": "#556b2f",
|
|
39
|
+
"DarkOliveGreen1": "#caff70",
|
|
40
|
+
"DarkOliveGreen2": "#bcee68",
|
|
41
|
+
"DarkOliveGreen3": "#a2cd5a",
|
|
42
|
+
"DarkOliveGreen4": "#6e8b3d",
|
|
43
|
+
"DarkOrange": "#ff8c00",
|
|
44
|
+
"DarkOrange1": "#ff7f00",
|
|
45
|
+
"DarkOrange2": "#ee7600",
|
|
46
|
+
"DarkOrange3": "#cd6600",
|
|
47
|
+
"DarkOrange4": "#8b4500",
|
|
48
|
+
"DarkOrchid": "#9932cc",
|
|
49
|
+
"DarkOrchid1": "#bf3eff",
|
|
50
|
+
"DarkOrchid2": "#b23aee",
|
|
51
|
+
"DarkOrchid3": "#9a32cd",
|
|
52
|
+
"DarkOrchid4": "#68228b",
|
|
53
|
+
"DarkRed": "#8b0000",
|
|
54
|
+
"DarkSalmon": "#e9967a",
|
|
55
|
+
"DarkSeaGreen": "#8fbc8f",
|
|
56
|
+
"DarkSeaGreen1": "#c1ffc1",
|
|
57
|
+
"DarkSeaGreen2": "#b4eeb4",
|
|
58
|
+
"DarkSeaGreen3": "#9bcd9b",
|
|
59
|
+
"DarkSeaGreen4": "#698b69",
|
|
60
|
+
"DarkSlateBlue": "#483d8b",
|
|
61
|
+
"DarkSlateGray": "#2f4f4f",
|
|
62
|
+
"DarkSlateGray1": "#97ffff",
|
|
63
|
+
"DarkSlateGray2": "#8deeee",
|
|
64
|
+
"DarkSlateGray3": "#79cdcd",
|
|
65
|
+
"DarkSlateGray4": "#528b8b",
|
|
66
|
+
"DarkSlateGrey": "#2f4f4f",
|
|
67
|
+
"DarkTurquoise": "#00ced1",
|
|
68
|
+
"DarkViolet": "#9400d3",
|
|
69
|
+
"DeepPink": "#ff1493",
|
|
70
|
+
"DeepPink1": "#ff1493",
|
|
71
|
+
"DeepPink2": "#ee1289",
|
|
72
|
+
"DeepPink3": "#cd1076",
|
|
73
|
+
"DeepPink4": "#8b0a50",
|
|
74
|
+
"DeepSkyBlue": "#00bfff",
|
|
75
|
+
"DeepSkyBlue1": "#00bfff",
|
|
76
|
+
"DeepSkyBlue2": "#00b2ee",
|
|
77
|
+
"DeepSkyBlue3": "#009acd",
|
|
78
|
+
"DeepSkyBlue4": "#00688b",
|
|
79
|
+
"DimGray": "#696969",
|
|
80
|
+
"DimGrey": "#696969",
|
|
81
|
+
"DodgerBlue": "#1e90ff",
|
|
82
|
+
"DodgerBlue1": "#1e90ff",
|
|
83
|
+
"DodgerBlue2": "#1c86ee",
|
|
84
|
+
"DodgerBlue3": "#1874cd",
|
|
85
|
+
"DodgerBlue4": "#104e8b",
|
|
86
|
+
"FloralWhite": "#fffaf0",
|
|
87
|
+
"ForestGreen": "#228b22",
|
|
88
|
+
"GhostWhite": "#f8f8ff",
|
|
89
|
+
"GreenYellow": "#adff2f",
|
|
90
|
+
"HotPink": "#ff69b4",
|
|
91
|
+
"HotPink1": "#ff6eb4",
|
|
92
|
+
"HotPink2": "#ee6aa7",
|
|
93
|
+
"HotPink3": "#cd6090",
|
|
94
|
+
"HotPink4": "#8b3a62",
|
|
95
|
+
"IndianRed": "#cd5c5c",
|
|
96
|
+
"IndianRed1": "#ff6a6a",
|
|
97
|
+
"IndianRed2": "#ee6363",
|
|
98
|
+
"IndianRed3": "#cd5555",
|
|
99
|
+
"IndianRed4": "#8b3a3a",
|
|
100
|
+
"LavenderBlush": "#fff0f5",
|
|
101
|
+
"LavenderBlush1": "#fff0f5",
|
|
102
|
+
"LavenderBlush2": "#eee0e5",
|
|
103
|
+
"LavenderBlush3": "#cdc1c5",
|
|
104
|
+
"LavenderBlush4": "#8b8386",
|
|
105
|
+
"LawnGreen": "#7cfc00",
|
|
106
|
+
"LemonChiffon": "#fffacd",
|
|
107
|
+
"LemonChiffon1": "#fffacd",
|
|
108
|
+
"LemonChiffon2": "#eee9bf",
|
|
109
|
+
"LemonChiffon3": "#cdc9a5",
|
|
110
|
+
"LemonChiffon4": "#8b8970",
|
|
111
|
+
"LightBlue": "#add8e6",
|
|
112
|
+
"LightBlue1": "#bfefff",
|
|
113
|
+
"LightBlue2": "#b2dfee",
|
|
114
|
+
"LightBlue3": "#9ac0cd",
|
|
115
|
+
"LightBlue4": "#68838b",
|
|
116
|
+
"LightCoral": "#f08080",
|
|
117
|
+
"LightCyan": "#e0ffff",
|
|
118
|
+
"LightCyan1": "#e0ffff",
|
|
119
|
+
"LightCyan2": "#d1eeee",
|
|
120
|
+
"LightCyan3": "#b4cdcd",
|
|
121
|
+
"LightCyan4": "#7a8b8b",
|
|
122
|
+
"LightGoldenrod": "#eedd82",
|
|
123
|
+
"LightGoldenrod1": "#ffec8b",
|
|
124
|
+
"LightGoldenrod2": "#eedc82",
|
|
125
|
+
"LightGoldenrod3": "#cdbe70",
|
|
126
|
+
"LightGoldenrod4": "#8b814c",
|
|
127
|
+
"LightGoldenrodYellow": "#fafad2",
|
|
128
|
+
"LightGray": "#d3d3d3",
|
|
129
|
+
"LightGreen": "#90ee90",
|
|
130
|
+
"LightGrey": "#d3d3d3",
|
|
131
|
+
"LightPink": "#ffb6c1",
|
|
132
|
+
"LightPink1": "#ffaeb9",
|
|
133
|
+
"LightPink2": "#eea2ad",
|
|
134
|
+
"LightPink3": "#cd8c95",
|
|
135
|
+
"LightPink4": "#8b5f65",
|
|
136
|
+
"LightSalmon": "#ffa07a",
|
|
137
|
+
"LightSalmon1": "#ffa07a",
|
|
138
|
+
"LightSalmon2": "#ee9572",
|
|
139
|
+
"LightSalmon3": "#cd8162",
|
|
140
|
+
"LightSalmon4": "#8b5742",
|
|
141
|
+
"LightSeaGreen": "#20b2aa",
|
|
142
|
+
"LightSkyBlue": "#87cefa",
|
|
143
|
+
"LightSkyBlue1": "#b0e2ff",
|
|
144
|
+
"LightSkyBlue2": "#a4d3ee",
|
|
145
|
+
"LightSkyBlue3": "#8db6cd",
|
|
146
|
+
"LightSkyBlue4": "#607b8b",
|
|
147
|
+
"LightSlateBlue": "#8470ff",
|
|
148
|
+
"LightSlateGray": "#778899",
|
|
149
|
+
"LightSlateGrey": "#778899",
|
|
150
|
+
"LightSteelBlue": "#b0c4de",
|
|
151
|
+
"LightSteelBlue1": "#cae1ff",
|
|
152
|
+
"LightSteelBlue2": "#bcd2ee",
|
|
153
|
+
"LightSteelBlue3": "#a2b5cd",
|
|
154
|
+
"LightSteelBlue4": "#6e7b8b",
|
|
155
|
+
"LightYellow": "#ffffe0",
|
|
156
|
+
"LightYellow1": "#ffffe0",
|
|
157
|
+
"LightYellow2": "#eeeed1",
|
|
158
|
+
"LightYellow3": "#cdcdb4",
|
|
159
|
+
"LightYellow4": "#8b8b7a",
|
|
160
|
+
"LimeGreen": "#32cd32",
|
|
161
|
+
"MediumAquamarine": "#66cdaa",
|
|
162
|
+
"MediumBlue": "#0000cd",
|
|
163
|
+
"MediumOrchid": "#ba55d3",
|
|
164
|
+
"MediumOrchid1": "#e066ff",
|
|
165
|
+
"MediumOrchid2": "#d15fee",
|
|
166
|
+
"MediumOrchid3": "#b452cd",
|
|
167
|
+
"MediumOrchid4": "#7a378b",
|
|
168
|
+
"MediumPurple": "#9370db",
|
|
169
|
+
"MediumPurple1": "#ab82ff",
|
|
170
|
+
"MediumPurple2": "#9f79ee",
|
|
171
|
+
"MediumPurple3": "#8968cd",
|
|
172
|
+
"MediumPurple4": "#5d478b",
|
|
173
|
+
"MediumSeaGreen": "#3cb371",
|
|
174
|
+
"MediumSlateBlue": "#7b68ee",
|
|
175
|
+
"MediumSpringGreen": "#00fa9a",
|
|
176
|
+
"MediumTurquoise": "#48d1cc",
|
|
177
|
+
"MediumVioletRed": "#c71585",
|
|
178
|
+
"MidnightBlue": "#191970",
|
|
179
|
+
"MintCream": "#f5fffa",
|
|
180
|
+
"MistyRose": "#ffe4e1",
|
|
181
|
+
"MistyRose1": "#ffe4e1",
|
|
182
|
+
"MistyRose2": "#eed5d2",
|
|
183
|
+
"MistyRose3": "#cdb7b5",
|
|
184
|
+
"MistyRose4": "#8b7d7b",
|
|
185
|
+
"NavajoWhite": "#ffdead",
|
|
186
|
+
"NavajoWhite1": "#ffdead",
|
|
187
|
+
"NavajoWhite2": "#eecfa1",
|
|
188
|
+
"NavajoWhite3": "#cdb38b",
|
|
189
|
+
"NavajoWhite4": "#8b795e",
|
|
190
|
+
"NavyBlue": "#000080",
|
|
191
|
+
"OldLace": "#fdf5e6",
|
|
192
|
+
"OliveDrab": "#6b8e23",
|
|
193
|
+
"OliveDrab1": "#c0ff3e",
|
|
194
|
+
"OliveDrab2": "#b3ee3a",
|
|
195
|
+
"OliveDrab3": "#9acd32",
|
|
196
|
+
"OliveDrab4": "#698b22",
|
|
197
|
+
"OrangeRed": "#ff4500",
|
|
198
|
+
"OrangeRed1": "#ff4500",
|
|
199
|
+
"OrangeRed2": "#ee4000",
|
|
200
|
+
"OrangeRed3": "#cd3700",
|
|
201
|
+
"OrangeRed4": "#8b2500",
|
|
202
|
+
"PaleGoldenrod": "#eee8aa",
|
|
203
|
+
"PaleGreen": "#98fb98",
|
|
204
|
+
"PaleGreen1": "#9aff9a",
|
|
205
|
+
"PaleGreen2": "#90ee90",
|
|
206
|
+
"PaleGreen3": "#7ccd7c",
|
|
207
|
+
"PaleGreen4": "#548b54",
|
|
208
|
+
"PaleTurquoise": "#afeeee",
|
|
209
|
+
"PaleTurquoise1": "#bbffff",
|
|
210
|
+
"PaleTurquoise2": "#aeeeee",
|
|
211
|
+
"PaleTurquoise3": "#96cdcd",
|
|
212
|
+
"PaleTurquoise4": "#668b8b",
|
|
213
|
+
"PaleVioletRed": "#db7093",
|
|
214
|
+
"PaleVioletRed1": "#ff82ab",
|
|
215
|
+
"PaleVioletRed2": "#ee799f",
|
|
216
|
+
"PaleVioletRed3": "#cd6889",
|
|
217
|
+
"PaleVioletRed4": "#8b475d",
|
|
218
|
+
"PapayaWhip": "#ffefd5",
|
|
219
|
+
"PeachPuff": "#ffdab9",
|
|
220
|
+
"PeachPuff1": "#ffdab9",
|
|
221
|
+
"PeachPuff2": "#eecbad",
|
|
222
|
+
"PeachPuff3": "#cdaf95",
|
|
223
|
+
"PeachPuff4": "#8b7765",
|
|
224
|
+
"PowderBlue": "#b0e0e6",
|
|
225
|
+
"RebeccaPurple": "#663399",
|
|
226
|
+
"RosyBrown": "#bc8f8f",
|
|
227
|
+
"RosyBrown1": "#ffc1c1",
|
|
228
|
+
"RosyBrown2": "#eeb4b4",
|
|
229
|
+
"RosyBrown3": "#cd9b9b",
|
|
230
|
+
"RosyBrown4": "#8b6969",
|
|
231
|
+
"RoyalBlue": "#4169e1",
|
|
232
|
+
"RoyalBlue1": "#4876ff",
|
|
233
|
+
"RoyalBlue2": "#436eee",
|
|
234
|
+
"RoyalBlue3": "#3a5fcd",
|
|
235
|
+
"RoyalBlue4": "#27408b",
|
|
236
|
+
"SaddleBrown": "#8b4513",
|
|
237
|
+
"SandyBrown": "#f4a460",
|
|
238
|
+
"SeaGreen": "#2e8b57",
|
|
239
|
+
"SeaGreen1": "#54ff9f",
|
|
240
|
+
"SeaGreen2": "#4eee94",
|
|
241
|
+
"SeaGreen3": "#43cd80",
|
|
242
|
+
"SeaGreen4": "#2e8b57",
|
|
243
|
+
"SkyBlue": "#87ceeb",
|
|
244
|
+
"SkyBlue1": "#87ceff",
|
|
245
|
+
"SkyBlue2": "#7ec0ee",
|
|
246
|
+
"SkyBlue3": "#6ca6cd",
|
|
247
|
+
"SkyBlue4": "#4a708b",
|
|
248
|
+
"SlateBlue": "#6a5acd",
|
|
249
|
+
"SlateBlue1": "#836fff",
|
|
250
|
+
"SlateBlue2": "#7a67ee",
|
|
251
|
+
"SlateBlue3": "#6959cd",
|
|
252
|
+
"SlateBlue4": "#473c8b",
|
|
253
|
+
"SlateGray": "#708090",
|
|
254
|
+
"SlateGray1": "#c6e2ff",
|
|
255
|
+
"SlateGray2": "#b9d3ee",
|
|
256
|
+
"SlateGray3": "#9fb6cd",
|
|
257
|
+
"SlateGray4": "#6c7b8b",
|
|
258
|
+
"SlateGrey": "#708090",
|
|
259
|
+
"SpringGreen": "#00ff7f",
|
|
260
|
+
"SpringGreen1": "#00ff7f",
|
|
261
|
+
"SpringGreen2": "#00ee76",
|
|
262
|
+
"SpringGreen3": "#00cd66",
|
|
263
|
+
"SpringGreen4": "#008b45",
|
|
264
|
+
"SteelBlue": "#4682b4",
|
|
265
|
+
"SteelBlue1": "#63b8ff",
|
|
266
|
+
"SteelBlue2": "#5cacee",
|
|
267
|
+
"SteelBlue3": "#4f94cd",
|
|
268
|
+
"SteelBlue4": "#36648b",
|
|
269
|
+
"VioletRed": "#d02090",
|
|
270
|
+
"VioletRed1": "#ff3e96",
|
|
271
|
+
"VioletRed2": "#ee3a8c",
|
|
272
|
+
"VioletRed3": "#cd3278",
|
|
273
|
+
"VioletRed4": "#8b2252",
|
|
274
|
+
"WebGray": "#808080",
|
|
275
|
+
"WebGreen": "#008000",
|
|
276
|
+
"WebGrey": "#808080",
|
|
277
|
+
"WebMaroon": "#800000",
|
|
278
|
+
"WebPurple": "#800080",
|
|
279
|
+
"WhiteSmoke": "#f5f5f5",
|
|
280
|
+
"X11Gray": "#bebebe",
|
|
281
|
+
"X11Green": "#00ff00",
|
|
282
|
+
"X11Grey": "#bebebe",
|
|
283
|
+
"X11Maroon": "#b03060",
|
|
284
|
+
"X11Purple": "#a020f0",
|
|
285
|
+
"YellowGreen": "#9acd32",
|
|
286
|
+
"alice blue": "#f0f8ff",
|
|
287
|
+
"antique white": "#faebd7",
|
|
288
|
+
"aqua": "#00ffff",
|
|
289
|
+
"aquamarine": "#7fffd4",
|
|
290
|
+
"aquamarine1": "#7fffd4",
|
|
291
|
+
"aquamarine2": "#76eec6",
|
|
292
|
+
"aquamarine3": "#66cdaa",
|
|
293
|
+
"aquamarine4": "#458b74",
|
|
294
|
+
"azure": "#f0ffff",
|
|
295
|
+
"azure1": "#f0ffff",
|
|
296
|
+
"azure2": "#e0eeee",
|
|
297
|
+
"azure3": "#c1cdcd",
|
|
298
|
+
"azure4": "#838b8b",
|
|
299
|
+
"beige": "#f5f5dc",
|
|
300
|
+
"bisque": "#ffe4c4",
|
|
301
|
+
"bisque1": "#ffe4c4",
|
|
302
|
+
"bisque2": "#eed5b7",
|
|
303
|
+
"bisque3": "#cdb79e",
|
|
304
|
+
"bisque4": "#8b7d6b",
|
|
305
|
+
"black": "#000000",
|
|
306
|
+
"blanched almond": "#ffebcd",
|
|
307
|
+
"blue violet": "#8a2be2",
|
|
308
|
+
"blue": "#0000ff",
|
|
309
|
+
"blue1": "#0000ff",
|
|
310
|
+
"blue2": "#0000ee",
|
|
311
|
+
"blue3": "#0000cd",
|
|
312
|
+
"blue4": "#00008b",
|
|
313
|
+
"brown": "#a52a2a",
|
|
314
|
+
"brown1": "#ff4040",
|
|
315
|
+
"brown2": "#ee3b3b",
|
|
316
|
+
"brown3": "#cd3333",
|
|
317
|
+
"brown4": "#8b2323",
|
|
318
|
+
"burlywood": "#deb887",
|
|
319
|
+
"burlywood1": "#ffd39b",
|
|
320
|
+
"burlywood2": "#eec591",
|
|
321
|
+
"burlywood3": "#cdaa7d",
|
|
322
|
+
"burlywood4": "#8b7355",
|
|
323
|
+
"cadet blue": "#5f9ea0",
|
|
324
|
+
"chartreuse": "#7fff00",
|
|
325
|
+
"chartreuse1": "#7fff00",
|
|
326
|
+
"chartreuse2": "#76ee00",
|
|
327
|
+
"chartreuse3": "#66cd00",
|
|
328
|
+
"chartreuse4": "#458b00",
|
|
329
|
+
"chocolate": "#d2691e",
|
|
330
|
+
"chocolate1": "#ff7f24",
|
|
331
|
+
"chocolate2": "#ee7621",
|
|
332
|
+
"chocolate3": "#cd661d",
|
|
333
|
+
"chocolate4": "#8b4513",
|
|
334
|
+
"coral": "#ff7f50",
|
|
335
|
+
"coral1": "#ff7256",
|
|
336
|
+
"coral2": "#ee6a50",
|
|
337
|
+
"coral3": "#cd5b45",
|
|
338
|
+
"coral4": "#8b3e2f",
|
|
339
|
+
"cornflower blue": "#6495ed",
|
|
340
|
+
"cornsilk": "#fff8dc",
|
|
341
|
+
"cornsilk1": "#fff8dc",
|
|
342
|
+
"cornsilk2": "#eee8cd",
|
|
343
|
+
"cornsilk3": "#cdc8b1",
|
|
344
|
+
"cornsilk4": "#8b8878",
|
|
345
|
+
"crimson": "#dc143c",
|
|
346
|
+
"cyan": "#00ffff",
|
|
347
|
+
"cyan1": "#00ffff",
|
|
348
|
+
"cyan2": "#00eeee",
|
|
349
|
+
"cyan3": "#00cdcd",
|
|
350
|
+
"cyan4": "#008b8b",
|
|
351
|
+
"dark blue": "#00008b",
|
|
352
|
+
"dark cyan": "#008b8b",
|
|
353
|
+
"dark goldenrod": "#b8860b",
|
|
354
|
+
"dark gray": "#a9a9a9",
|
|
355
|
+
"dark green": "#006400",
|
|
356
|
+
"dark grey": "#a9a9a9",
|
|
357
|
+
"dark khaki": "#bdb76b",
|
|
358
|
+
"dark magenta": "#8b008b",
|
|
359
|
+
"dark olive green": "#556b2f",
|
|
360
|
+
"dark orange": "#ff8c00",
|
|
361
|
+
"dark orchid": "#9932cc",
|
|
362
|
+
"dark red": "#8b0000",
|
|
363
|
+
"dark salmon": "#e9967a",
|
|
364
|
+
"dark sea green": "#8fbc8f",
|
|
365
|
+
"dark slate blue": "#483d8b",
|
|
366
|
+
"dark slate gray": "#2f4f4f",
|
|
367
|
+
"dark slate grey": "#2f4f4f",
|
|
368
|
+
"dark turquoise": "#00ced1",
|
|
369
|
+
"dark violet": "#9400d3",
|
|
370
|
+
"deep pink": "#ff1493",
|
|
371
|
+
"deep sky blue": "#00bfff",
|
|
372
|
+
"dim gray": "#696969",
|
|
373
|
+
"dim grey": "#696969",
|
|
374
|
+
"dodger blue": "#1e90ff",
|
|
375
|
+
"firebrick": "#b22222",
|
|
376
|
+
"firebrick1": "#ff3030",
|
|
377
|
+
"firebrick2": "#ee2c2c",
|
|
378
|
+
"firebrick3": "#cd2626",
|
|
379
|
+
"firebrick4": "#8b1a1a",
|
|
380
|
+
"floral white": "#fffaf0",
|
|
381
|
+
"forest green": "#228b22",
|
|
382
|
+
"fuchsia": "#ff00ff",
|
|
383
|
+
"gainsboro": "#dcdcdc",
|
|
384
|
+
"ghost white": "#f8f8ff",
|
|
385
|
+
"gold": "#ffd700",
|
|
386
|
+
"gold1": "#ffd700",
|
|
387
|
+
"gold2": "#eec900",
|
|
388
|
+
"gold3": "#cdad00",
|
|
389
|
+
"gold4": "#8b7500",
|
|
390
|
+
"goldenrod": "#daa520",
|
|
391
|
+
"goldenrod1": "#ffc125",
|
|
392
|
+
"goldenrod2": "#eeb422",
|
|
393
|
+
"goldenrod3": "#cd9b1d",
|
|
394
|
+
"goldenrod4": "#8b6914",
|
|
395
|
+
"green yellow": "#adff2f",
|
|
396
|
+
"green": "#00ff00",
|
|
397
|
+
"green1": "#00ff00",
|
|
398
|
+
"green2": "#00ee00",
|
|
399
|
+
"green3": "#00cd00",
|
|
400
|
+
"green4": "#008b00",
|
|
401
|
+
"honeydew": "#f0fff0",
|
|
402
|
+
"honeydew1": "#f0fff0",
|
|
403
|
+
"honeydew2": "#e0eee0",
|
|
404
|
+
"honeydew3": "#c1cdc1",
|
|
405
|
+
"honeydew4": "#838b83",
|
|
406
|
+
"hot pink": "#ff69b4",
|
|
407
|
+
"indian red": "#cd5c5c",
|
|
408
|
+
"indigo": "#4b0082",
|
|
409
|
+
"ivory": "#fffff0",
|
|
410
|
+
"ivory1": "#fffff0",
|
|
411
|
+
"ivory2": "#eeeee0",
|
|
412
|
+
"ivory3": "#cdcdc1",
|
|
413
|
+
"ivory4": "#8b8b83",
|
|
414
|
+
"khaki": "#f0e68c",
|
|
415
|
+
"khaki1": "#fff68f",
|
|
416
|
+
"khaki2": "#eee685",
|
|
417
|
+
"khaki3": "#cdc673",
|
|
418
|
+
"khaki4": "#8b864e",
|
|
419
|
+
"lavender blush": "#fff0f5",
|
|
420
|
+
"lavender": "#e6e6fa",
|
|
421
|
+
"lawn green": "#7cfc00",
|
|
422
|
+
"lemon chiffon": "#fffacd",
|
|
423
|
+
"light blue": "#add8e6",
|
|
424
|
+
"light coral": "#f08080",
|
|
425
|
+
"light cyan": "#e0ffff",
|
|
426
|
+
"light goldenrod yellow": "#fafad2",
|
|
427
|
+
"light goldenrod": "#eedd82",
|
|
428
|
+
"light gray": "#d3d3d3",
|
|
429
|
+
"light green": "#90ee90",
|
|
430
|
+
"light grey": "#d3d3d3",
|
|
431
|
+
"light pink": "#ffb6c1",
|
|
432
|
+
"light salmon": "#ffa07a",
|
|
433
|
+
"light sea green": "#20b2aa",
|
|
434
|
+
"light sky blue": "#87cefa",
|
|
435
|
+
"light slate blue": "#8470ff",
|
|
436
|
+
"light slate gray": "#778899",
|
|
437
|
+
"light slate grey": "#778899",
|
|
438
|
+
"light steel blue": "#b0c4de",
|
|
439
|
+
"light yellow": "#ffffe0",
|
|
440
|
+
"lime green": "#32cd32",
|
|
441
|
+
"lime": "#00ff00",
|
|
442
|
+
"linen": "#faf0e6",
|
|
443
|
+
"magenta": "#ff00ff",
|
|
444
|
+
"magenta1": "#ff00ff",
|
|
445
|
+
"magenta2": "#ee00ee",
|
|
446
|
+
"magenta3": "#cd00cd",
|
|
447
|
+
"magenta4": "#8b008b",
|
|
448
|
+
"maroon": "#b03060",
|
|
449
|
+
"maroon1": "#ff34b3",
|
|
450
|
+
"maroon2": "#ee30a7",
|
|
451
|
+
"maroon3": "#cd2990",
|
|
452
|
+
"maroon4": "#8b1c62",
|
|
453
|
+
"medium aquamarine": "#66cdaa",
|
|
454
|
+
"medium blue": "#0000cd",
|
|
455
|
+
"medium orchid": "#ba55d3",
|
|
456
|
+
"medium purple": "#9370db",
|
|
457
|
+
"medium sea green": "#3cb371",
|
|
458
|
+
"medium slate blue": "#7b68ee",
|
|
459
|
+
"medium spring green": "#00fa9a",
|
|
460
|
+
"medium turquoise": "#48d1cc",
|
|
461
|
+
"medium violet red": "#c71585",
|
|
462
|
+
"midnight blue": "#191970",
|
|
463
|
+
"mint cream": "#f5fffa",
|
|
464
|
+
"misty rose": "#ffe4e1",
|
|
465
|
+
"moccasin": "#ffe4b5",
|
|
466
|
+
"navajo white": "#ffdead",
|
|
467
|
+
"navy blue": "#000080",
|
|
468
|
+
"navy": "#000080",
|
|
469
|
+
"old lace": "#fdf5e6",
|
|
470
|
+
"olive drab": "#6b8e23",
|
|
471
|
+
"olive": "#808000",
|
|
472
|
+
"orange red": "#ff4500",
|
|
473
|
+
"orange": "#ffa500",
|
|
474
|
+
"orange1": "#ffa500",
|
|
475
|
+
"orange2": "#ee9a00",
|
|
476
|
+
"orange3": "#cd8500",
|
|
477
|
+
"orange4": "#8b5a00",
|
|
478
|
+
"orchid": "#da70d6",
|
|
479
|
+
"orchid1": "#ff83fa",
|
|
480
|
+
"orchid2": "#ee7ae9",
|
|
481
|
+
"orchid3": "#cd69c9",
|
|
482
|
+
"orchid4": "#8b4789",
|
|
483
|
+
"pale goldenrod": "#eee8aa",
|
|
484
|
+
"pale green": "#98fb98",
|
|
485
|
+
"pale turquoise": "#afeeee",
|
|
486
|
+
"pale violet red": "#db7093",
|
|
487
|
+
"papaya whip": "#ffefd5",
|
|
488
|
+
"peach puff": "#ffdab9",
|
|
489
|
+
"peru": "#cd853f",
|
|
490
|
+
"pink": "#ffc0cb",
|
|
491
|
+
"pink1": "#ffb5c5",
|
|
492
|
+
"pink2": "#eea9b8",
|
|
493
|
+
"pink3": "#cd919e",
|
|
494
|
+
"pink4": "#8b636c",
|
|
495
|
+
"plum": "#dda0dd",
|
|
496
|
+
"plum1": "#ffbbff",
|
|
497
|
+
"plum2": "#eeaeee",
|
|
498
|
+
"plum3": "#cd96cd",
|
|
499
|
+
"plum4": "#8b668b",
|
|
500
|
+
"powder blue": "#b0e0e6",
|
|
501
|
+
"purple": "#a020f0",
|
|
502
|
+
"purple1": "#9b30ff",
|
|
503
|
+
"purple2": "#912cee",
|
|
504
|
+
"purple3": "#7d26cd",
|
|
505
|
+
"purple4": "#551a8b",
|
|
506
|
+
"rebecca purple": "#663399",
|
|
507
|
+
"red": "#ff0000",
|
|
508
|
+
"red1": "#ff0000",
|
|
509
|
+
"red2": "#ee0000",
|
|
510
|
+
"red3": "#cd0000",
|
|
511
|
+
"red4": "#8b0000",
|
|
512
|
+
"rosy brown": "#bc8f8f",
|
|
513
|
+
"royal blue": "#4169e1",
|
|
514
|
+
"saddle brown": "#8b4513",
|
|
515
|
+
"salmon": "#fa8072",
|
|
516
|
+
"salmon1": "#ff8c69",
|
|
517
|
+
"salmon2": "#ee8262",
|
|
518
|
+
"salmon3": "#cd7054",
|
|
519
|
+
"salmon4": "#8b4c39",
|
|
520
|
+
"sandy brown": "#f4a460",
|
|
521
|
+
"sea green": "#2e8b57",
|
|
522
|
+
"seashell": "#fff5ee",
|
|
523
|
+
"seashell1": "#fff5ee",
|
|
524
|
+
"seashell2": "#eee5de",
|
|
525
|
+
"seashell3": "#cdc5bf",
|
|
526
|
+
"seashell4": "#8b8682",
|
|
527
|
+
"sienna": "#a0522d",
|
|
528
|
+
"sienna1": "#ff8247",
|
|
529
|
+
"sienna2": "#ee7942",
|
|
530
|
+
"sienna3": "#cd6839",
|
|
531
|
+
"sienna4": "#8b4726",
|
|
532
|
+
"silver": "#c0c0c0",
|
|
533
|
+
"sky blue": "#87ceeb",
|
|
534
|
+
"slate blue": "#6a5acd",
|
|
535
|
+
"slate gray": "#708090",
|
|
536
|
+
"slate grey": "#708090",
|
|
537
|
+
"snow": "#fffafa",
|
|
538
|
+
"snow1": "#fffafa",
|
|
539
|
+
"snow2": "#eee9e9",
|
|
540
|
+
"snow3": "#cdc9c9",
|
|
541
|
+
"snow4": "#8b8989",
|
|
542
|
+
"spring green": "#00ff7f",
|
|
543
|
+
"steel blue": "#4682b4",
|
|
544
|
+
"tan": "#d2b48c",
|
|
545
|
+
"tan1": "#ffa54f",
|
|
546
|
+
"tan2": "#ee9a49",
|
|
547
|
+
"tan3": "#cd853f",
|
|
548
|
+
"tan4": "#8b5a2b",
|
|
549
|
+
"teal": "#008080",
|
|
550
|
+
"thistle": "#d8bfd8",
|
|
551
|
+
"thistle1": "#ffe1ff",
|
|
552
|
+
"thistle2": "#eed2ee",
|
|
553
|
+
"thistle3": "#cdb5cd",
|
|
554
|
+
"thistle4": "#8b7b8b",
|
|
555
|
+
"tomato": "#ff6347",
|
|
556
|
+
"tomato1": "#ff6347",
|
|
557
|
+
"tomato2": "#ee5c42",
|
|
558
|
+
"tomato3": "#cd4f39",
|
|
559
|
+
"tomato4": "#8b3626",
|
|
560
|
+
"turquoise": "#40e0d0",
|
|
561
|
+
"turquoise1": "#00f5ff",
|
|
562
|
+
"turquoise2": "#00e5ee",
|
|
563
|
+
"turquoise3": "#00c5cd",
|
|
564
|
+
"turquoise4": "#00868b",
|
|
565
|
+
"violet red": "#d02090",
|
|
566
|
+
"violet": "#ee82ee",
|
|
567
|
+
"web gray": "#808080",
|
|
568
|
+
"web green": "#008000",
|
|
569
|
+
"web grey": "#808080",
|
|
570
|
+
"web maroon": "#800000",
|
|
571
|
+
"web purple": "#800080",
|
|
572
|
+
"wheat": "#f5deb3",
|
|
573
|
+
"wheat1": "#ffe7ba",
|
|
574
|
+
"wheat2": "#eed8ae",
|
|
575
|
+
"wheat3": "#cdba96",
|
|
576
|
+
"wheat4": "#8b7e66",
|
|
577
|
+
"white smoke": "#f5f5f5",
|
|
578
|
+
"white": "#ffffff",
|
|
579
|
+
"x11 gray": "#bebebe",
|
|
580
|
+
"x11 green": "#00ff00",
|
|
581
|
+
"x11 grey": "#bebebe",
|
|
582
|
+
"x11 maroon": "#b03060",
|
|
583
|
+
"x11 purple": "#a020f0",
|
|
584
|
+
"yellow green": "#9acd32",
|
|
585
|
+
"yellow": "#ffff00",
|
|
586
|
+
"yellow1": "#ffff00",
|
|
587
|
+
"yellow2": "#eeee00",
|
|
588
|
+
"yellow3": "#cdcd00",
|
|
589
|
+
"yellow4": "#8b8b00",
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
def parse_color(name: str) -> Color:
|
|
594
|
+
"""Parse color string to Textual Color. Tries Color.parse() first, then X11 names."""
|
|
595
|
+
# Handle color(n) format for 8-bit colors
|
|
596
|
+
if name.startswith("color(") and name.endswith(")"):
|
|
597
|
+
try:
|
|
598
|
+
index = int(name[6:-1])
|
|
599
|
+
if 0 <= index <= 255:
|
|
600
|
+
return Color.from_rich_color(RichColor.from_ansi(index))
|
|
601
|
+
except ValueError:
|
|
602
|
+
pass
|
|
603
|
+
|
|
604
|
+
# Try standard parsing first
|
|
605
|
+
try:
|
|
606
|
+
return Color.parse(name)
|
|
607
|
+
except Exception:
|
|
608
|
+
pass
|
|
609
|
+
|
|
610
|
+
# Fall back to X11 names (case-insensitive)
|
|
611
|
+
# Create a lowercase mapping for case-insensitive lookup
|
|
612
|
+
for key, value in X11_NAMES.items():
|
|
613
|
+
if key.lower() == name.lower():
|
|
614
|
+
return Color.parse(value)
|
|
615
|
+
|
|
616
|
+
raise ValueError(f"Unknown color: {name}")
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
# Palette management for dynamic 256-color palette (OSC 4 support)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
def palette_init() -> list[Optional[Tuple[int, int, int]]]:
|
|
623
|
+
"""Initialize 256-entry palette (all None)."""
|
|
624
|
+
return [None] * 256
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def palette_clear(palette: list) -> None:
|
|
628
|
+
"""Reset palette to default state."""
|
|
629
|
+
for i in range(len(palette)):
|
|
630
|
+
palette[i] = None
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
def palette_get(palette: list, index: int) -> Optional[Tuple[int, int, int]]:
|
|
634
|
+
"""Get RGB for palette index, None if unset."""
|
|
635
|
+
if 0 <= index < len(palette):
|
|
636
|
+
return palette[index]
|
|
637
|
+
return None
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
def palette_set(palette: list, index: int, color: Tuple[int, int, int]) -> None:
|
|
641
|
+
"""Set RGB value for palette index."""
|
|
642
|
+
if 0 <= index < len(palette):
|
|
643
|
+
palette[index] = color
|