wezterm-theme 1.0.0__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.
- wezterm_theme/__init__.py +4 -0
- wezterm_theme/__main__.py +6 -0
- wezterm_theme/assets/studio.html +1508 -0
- wezterm_theme/cli.py +437 -0
- wezterm_theme/core.py +921 -0
- wezterm_theme/fonts.py +448 -0
- wezterm_theme/paths.py +196 -0
- wezterm_theme/server.py +303 -0
- wezterm_theme/themes.py +2088 -0
- wezterm_theme/tui.py +855 -0
- wezterm_theme-1.0.0.dist-info/METADATA +204 -0
- wezterm_theme-1.0.0.dist-info/RECORD +16 -0
- wezterm_theme-1.0.0.dist-info/WHEEL +5 -0
- wezterm_theme-1.0.0.dist-info/entry_points.txt +3 -0
- wezterm_theme-1.0.0.dist-info/licenses/LICENSE +21 -0
- wezterm_theme-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1508 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>WezTerm Studio — Tab Themes, Symbols, Fonts & Appearance</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--bg: #0f111a;
|
|
10
|
+
--panel: #171b28;
|
|
11
|
+
--panel2: #1f2537;
|
|
12
|
+
--border: #2c354d;
|
|
13
|
+
--text: #e6edf3;
|
|
14
|
+
--sub: #94a3b8;
|
|
15
|
+
--accent: #60a5fa;
|
|
16
|
+
--purple: #c084fc;
|
|
17
|
+
--green: #34d399;
|
|
18
|
+
--amber: #fbbf24;
|
|
19
|
+
--red: #f87171;
|
|
20
|
+
}
|
|
21
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
22
|
+
body {
|
|
23
|
+
background: var(--bg);
|
|
24
|
+
color: var(--text);
|
|
25
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
26
|
+
min-height: 100vh;
|
|
27
|
+
padding-bottom: 64px;
|
|
28
|
+
}
|
|
29
|
+
button, input, select, textarea { font-family: inherit; }
|
|
30
|
+
|
|
31
|
+
/* ── Sticky Top Header ── */
|
|
32
|
+
.studio-header {
|
|
33
|
+
position: sticky;
|
|
34
|
+
top: 0;
|
|
35
|
+
z-index: 50;
|
|
36
|
+
background: rgba(15, 17, 26, 0.92);
|
|
37
|
+
backdrop-filter: blur(12px);
|
|
38
|
+
border-bottom: 1px solid var(--border);
|
|
39
|
+
padding: 14px 24px 0;
|
|
40
|
+
}
|
|
41
|
+
.header-inner {
|
|
42
|
+
max-width: 1440px;
|
|
43
|
+
margin: 0 auto;
|
|
44
|
+
}
|
|
45
|
+
.header-top {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-wrap: wrap;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 16px;
|
|
50
|
+
margin-bottom: 12px;
|
|
51
|
+
}
|
|
52
|
+
.brand {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 10px;
|
|
56
|
+
margin-right: 8px;
|
|
57
|
+
}
|
|
58
|
+
.brand h1 {
|
|
59
|
+
font-size: 1.25rem;
|
|
60
|
+
font-weight: 800;
|
|
61
|
+
letter-spacing: -0.02em;
|
|
62
|
+
background: linear-gradient(90deg, #60a5fa, #c084fc);
|
|
63
|
+
-webkit-background-clip: text;
|
|
64
|
+
-webkit-text-fill-color: transparent;
|
|
65
|
+
}
|
|
66
|
+
.mode-pill {
|
|
67
|
+
font-size: 0.72rem;
|
|
68
|
+
padding: 3px 9px;
|
|
69
|
+
border-radius: 999px;
|
|
70
|
+
background: var(--panel2);
|
|
71
|
+
border: 1px solid var(--border);
|
|
72
|
+
color: var(--sub);
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
}
|
|
75
|
+
.init-banner {
|
|
76
|
+
display: none;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 10px;
|
|
79
|
+
background: rgba(251, 191, 36, 0.12);
|
|
80
|
+
border: 1px solid rgba(251, 191, 36, 0.45);
|
|
81
|
+
color: var(--amber);
|
|
82
|
+
padding: 6px 12px;
|
|
83
|
+
border-radius: 8px;
|
|
84
|
+
font-size: 0.8rem;
|
|
85
|
+
}
|
|
86
|
+
.init-banner.visible { display: inline-flex; }
|
|
87
|
+
.init-banner button {
|
|
88
|
+
background: var(--amber);
|
|
89
|
+
color: #111827;
|
|
90
|
+
border: none;
|
|
91
|
+
border-radius: 6px;
|
|
92
|
+
padding: 4px 10px;
|
|
93
|
+
font-weight: 700;
|
|
94
|
+
font-size: 0.76rem;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Quick Font & Theme Strip */
|
|
99
|
+
.quick-strip {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-wrap: wrap;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 12px;
|
|
104
|
+
flex: 1;
|
|
105
|
+
}
|
|
106
|
+
.q-box {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 6px;
|
|
110
|
+
background: var(--panel);
|
|
111
|
+
border: 1px solid var(--border);
|
|
112
|
+
border-radius: 8px;
|
|
113
|
+
padding: 4px 8px;
|
|
114
|
+
font-size: 0.76rem;
|
|
115
|
+
}
|
|
116
|
+
.q-label {
|
|
117
|
+
font-weight: 700;
|
|
118
|
+
text-transform: uppercase;
|
|
119
|
+
font-size: 0.66rem;
|
|
120
|
+
letter-spacing: 0.05em;
|
|
121
|
+
}
|
|
122
|
+
.q-label.theme { color: var(--green); }
|
|
123
|
+
.q-label.editor { color: var(--accent); }
|
|
124
|
+
.q-label.tab { color: var(--purple); }
|
|
125
|
+
.q-val {
|
|
126
|
+
max-width: 175px;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
text-overflow: ellipsis;
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
}
|
|
132
|
+
.q-select {
|
|
133
|
+
background: var(--panel2);
|
|
134
|
+
color: var(--text);
|
|
135
|
+
border: 1px solid var(--border);
|
|
136
|
+
border-radius: 5px;
|
|
137
|
+
padding: 2px 5px;
|
|
138
|
+
font-size: 0.74rem;
|
|
139
|
+
}
|
|
140
|
+
.stepper {
|
|
141
|
+
display: inline-flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
border: 1px solid var(--border);
|
|
144
|
+
border-radius: 5px;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
background: var(--panel2);
|
|
147
|
+
}
|
|
148
|
+
.stepper button {
|
|
149
|
+
background: none;
|
|
150
|
+
border: none;
|
|
151
|
+
color: var(--sub);
|
|
152
|
+
width: 20px;
|
|
153
|
+
height: 22px;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
font-weight: 700;
|
|
156
|
+
}
|
|
157
|
+
.stepper button:hover { background: var(--border); color: var(--text); }
|
|
158
|
+
.stepper input {
|
|
159
|
+
width: 36px;
|
|
160
|
+
background: transparent;
|
|
161
|
+
color: var(--text);
|
|
162
|
+
border: none;
|
|
163
|
+
text-align: center;
|
|
164
|
+
font-size: 0.75rem;
|
|
165
|
+
outline: none;
|
|
166
|
+
}
|
|
167
|
+
.status-pill {
|
|
168
|
+
margin-left: auto;
|
|
169
|
+
font-size: 0.78rem;
|
|
170
|
+
font-weight: 600;
|
|
171
|
+
color: var(--sub);
|
|
172
|
+
padding: 5px 10px;
|
|
173
|
+
border-radius: 999px;
|
|
174
|
+
background: var(--panel);
|
|
175
|
+
border: 1px solid var(--border);
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
}
|
|
178
|
+
.status-pill.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.45); }
|
|
179
|
+
.status-pill.err { color: var(--red); border-color: rgba(248, 113, 113, 0.45); }
|
|
180
|
+
|
|
181
|
+
/* Navigation Tabs */
|
|
182
|
+
.nav-tabs {
|
|
183
|
+
display: flex;
|
|
184
|
+
gap: 6px;
|
|
185
|
+
overflow-x: auto;
|
|
186
|
+
}
|
|
187
|
+
.nav-tab {
|
|
188
|
+
background: transparent;
|
|
189
|
+
border: none;
|
|
190
|
+
border-bottom: 2px solid transparent;
|
|
191
|
+
color: var(--sub);
|
|
192
|
+
padding: 10px 16px;
|
|
193
|
+
font-size: 0.86rem;
|
|
194
|
+
font-weight: 600;
|
|
195
|
+
cursor: pointer;
|
|
196
|
+
white-space: nowrap;
|
|
197
|
+
transition: color 0.15s, border-color 0.15s;
|
|
198
|
+
}
|
|
199
|
+
.nav-tab:hover { color: var(--text); }
|
|
200
|
+
.nav-tab.active {
|
|
201
|
+
color: var(--accent);
|
|
202
|
+
border-bottom-color: var(--accent);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* Main Container */
|
|
206
|
+
.container {
|
|
207
|
+
max-width: 1440px;
|
|
208
|
+
margin: 22px auto 0;
|
|
209
|
+
padding: 0 24px;
|
|
210
|
+
}
|
|
211
|
+
.view-pane { display: none; }
|
|
212
|
+
.view-pane.active { display: block; }
|
|
213
|
+
|
|
214
|
+
/* Shared Toolbar & Buttons */
|
|
215
|
+
.toolbar {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-wrap: wrap;
|
|
218
|
+
align-items: center;
|
|
219
|
+
gap: 10px;
|
|
220
|
+
background: var(--panel);
|
|
221
|
+
border: 1px solid var(--border);
|
|
222
|
+
padding: 12px 14px;
|
|
223
|
+
border-radius: 12px;
|
|
224
|
+
margin-bottom: 14px;
|
|
225
|
+
}
|
|
226
|
+
.search-input {
|
|
227
|
+
flex: 1 1 260px;
|
|
228
|
+
background: var(--bg);
|
|
229
|
+
color: var(--text);
|
|
230
|
+
border: 1px solid var(--border);
|
|
231
|
+
border-radius: 8px;
|
|
232
|
+
padding: 8px 12px;
|
|
233
|
+
font-size: 0.9rem;
|
|
234
|
+
outline: none;
|
|
235
|
+
}
|
|
236
|
+
.search-input:focus { border-color: var(--accent); }
|
|
237
|
+
.btn {
|
|
238
|
+
background: var(--panel2);
|
|
239
|
+
color: var(--text);
|
|
240
|
+
border: 1px solid var(--border);
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
padding: 7px 13px;
|
|
243
|
+
font-size: 0.82rem;
|
|
244
|
+
font-weight: 600;
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
transition: all 0.15s;
|
|
247
|
+
}
|
|
248
|
+
.btn:hover { border-color: var(--accent); color: #fff; }
|
|
249
|
+
.btn-primary {
|
|
250
|
+
background: #2563eb;
|
|
251
|
+
border-color: #3b82f6;
|
|
252
|
+
color: #fff;
|
|
253
|
+
}
|
|
254
|
+
.btn-primary:hover { background: #1d4ed8; }
|
|
255
|
+
.btn-green {
|
|
256
|
+
background: rgba(16, 185, 129, 0.2);
|
|
257
|
+
border-color: var(--green);
|
|
258
|
+
color: var(--green);
|
|
259
|
+
}
|
|
260
|
+
.btn-purple {
|
|
261
|
+
background: rgba(192, 132, 252, 0.16);
|
|
262
|
+
border-color: var(--purple);
|
|
263
|
+
color: var(--purple);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/* Category Pills */
|
|
267
|
+
.pills-row {
|
|
268
|
+
display: flex;
|
|
269
|
+
flex-wrap: wrap;
|
|
270
|
+
gap: 8px;
|
|
271
|
+
margin-bottom: 16px;
|
|
272
|
+
}
|
|
273
|
+
.pill-btn {
|
|
274
|
+
background: var(--panel);
|
|
275
|
+
color: var(--sub);
|
|
276
|
+
border: 1px solid var(--border);
|
|
277
|
+
padding: 6px 12px;
|
|
278
|
+
border-radius: 999px;
|
|
279
|
+
font-size: 0.8rem;
|
|
280
|
+
font-weight: 600;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
}
|
|
283
|
+
.pill-btn.active, .pill-btn:hover {
|
|
284
|
+
color: #fff;
|
|
285
|
+
border-color: var(--accent);
|
|
286
|
+
background: rgba(96, 165, 250, 0.16);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Symbol Builder Drawer */
|
|
290
|
+
.sym-drawer {
|
|
291
|
+
display: none;
|
|
292
|
+
background: var(--panel);
|
|
293
|
+
border: 1px solid var(--border);
|
|
294
|
+
border-radius: 12px;
|
|
295
|
+
padding: 16px;
|
|
296
|
+
margin-bottom: 16px;
|
|
297
|
+
}
|
|
298
|
+
.sym-drawer.open { display: block; }
|
|
299
|
+
.sym-preview-box {
|
|
300
|
+
background: var(--bg);
|
|
301
|
+
border: 1px solid var(--border);
|
|
302
|
+
border-radius: 8px;
|
|
303
|
+
padding: 12px;
|
|
304
|
+
margin-bottom: 14px;
|
|
305
|
+
overflow-x: auto;
|
|
306
|
+
}
|
|
307
|
+
.sym-groups {
|
|
308
|
+
display: grid;
|
|
309
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
310
|
+
gap: 14px;
|
|
311
|
+
margin-bottom: 14px;
|
|
312
|
+
}
|
|
313
|
+
.sym-group h4 {
|
|
314
|
+
font-size: 0.78rem;
|
|
315
|
+
text-transform: uppercase;
|
|
316
|
+
letter-spacing: 0.05em;
|
|
317
|
+
color: var(--accent);
|
|
318
|
+
margin-bottom: 8px;
|
|
319
|
+
}
|
|
320
|
+
.sym-opts {
|
|
321
|
+
display: flex;
|
|
322
|
+
flex-wrap: wrap;
|
|
323
|
+
gap: 6px;
|
|
324
|
+
}
|
|
325
|
+
.sym-opt {
|
|
326
|
+
background: var(--panel2);
|
|
327
|
+
border: 1px solid var(--border);
|
|
328
|
+
color: var(--text);
|
|
329
|
+
border-radius: 7px;
|
|
330
|
+
padding: 5px 9px;
|
|
331
|
+
font-size: 0.78rem;
|
|
332
|
+
font-family: system-ui, -apple-system, "Segoe UI", "JetBrainsMono Nerd Font", "FiraCode Nerd Font", "MesloLGS Nerd Font", "CaskaydiaCove Nerd Font", "Symbols Nerd Font", sans-serif;
|
|
333
|
+
cursor: pointer;
|
|
334
|
+
}
|
|
335
|
+
.sym-opt.selected {
|
|
336
|
+
border-color: var(--green);
|
|
337
|
+
background: rgba(52, 211, 153, 0.16);
|
|
338
|
+
color: #fff;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* ── Tab Themes Grid ── */
|
|
342
|
+
.themes-grid {
|
|
343
|
+
display: grid;
|
|
344
|
+
grid-template-columns: repeat(auto-fill, minmax(540px, 1fr));
|
|
345
|
+
gap: 14px;
|
|
346
|
+
}
|
|
347
|
+
.theme-card {
|
|
348
|
+
background: var(--panel);
|
|
349
|
+
border: 1px solid var(--border);
|
|
350
|
+
border-radius: 12px;
|
|
351
|
+
padding: 15px;
|
|
352
|
+
display: flex;
|
|
353
|
+
flex-direction: column;
|
|
354
|
+
gap: 10px;
|
|
355
|
+
transition: border-color 0.15s;
|
|
356
|
+
}
|
|
357
|
+
.theme-card:hover { border-color: #475569; }
|
|
358
|
+
.theme-card.is-active {
|
|
359
|
+
border-color: var(--green);
|
|
360
|
+
box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35);
|
|
361
|
+
}
|
|
362
|
+
.tc-head {
|
|
363
|
+
display: flex;
|
|
364
|
+
justify-content: space-between;
|
|
365
|
+
align-items: center;
|
|
366
|
+
gap: 8px;
|
|
367
|
+
}
|
|
368
|
+
.tc-id { color: var(--accent); font-family: monospace; font-weight: 700; margin-right: 6px; }
|
|
369
|
+
.tc-name { font-weight: 700; font-size: 0.98rem; }
|
|
370
|
+
.tc-cat { color: var(--sub); font-size: 0.76rem; margin-left: 6px; }
|
|
371
|
+
.active-tag {
|
|
372
|
+
background: rgba(52, 211, 153, 0.16);
|
|
373
|
+
color: var(--green);
|
|
374
|
+
font-size: 0.72rem;
|
|
375
|
+
font-weight: 700;
|
|
376
|
+
padding: 2px 8px;
|
|
377
|
+
border-radius: 999px;
|
|
378
|
+
}
|
|
379
|
+
.swatches {
|
|
380
|
+
display: flex;
|
|
381
|
+
flex-wrap: wrap;
|
|
382
|
+
gap: 10px;
|
|
383
|
+
font-family: monospace;
|
|
384
|
+
font-size: 0.76rem;
|
|
385
|
+
color: var(--sub);
|
|
386
|
+
}
|
|
387
|
+
.swatch { display: inline-flex; align-items: center; gap: 5px; }
|
|
388
|
+
.dot {
|
|
389
|
+
width: 10px;
|
|
390
|
+
height: 10px;
|
|
391
|
+
border-radius: 50%;
|
|
392
|
+
border: 1px solid rgba(255,255,255,0.2);
|
|
393
|
+
}
|
|
394
|
+
.bar-wrap {
|
|
395
|
+
padding: 9px 10px;
|
|
396
|
+
border-radius: 8px;
|
|
397
|
+
overflow-x: auto;
|
|
398
|
+
font-family: var(--tab-preview-font, "JetBrains Mono", ui-monospace, monospace);
|
|
399
|
+
font-size: 12.2px;
|
|
400
|
+
line-height: 1.55;
|
|
401
|
+
white-space: pre;
|
|
402
|
+
border: 1px solid rgba(255,255,255,0.06);
|
|
403
|
+
}
|
|
404
|
+
.tab-seg { display: inline-block; padding: 2px 0; }
|
|
405
|
+
.tab-pill { border-radius: 5px; margin-right: 4px; }
|
|
406
|
+
.tc-desc { color: var(--sub); font-size: 0.82rem; line-height: 1.4; }
|
|
407
|
+
.tc-foot {
|
|
408
|
+
display: flex;
|
|
409
|
+
justify-content: space-between;
|
|
410
|
+
align-items: center;
|
|
411
|
+
gap: 8px;
|
|
412
|
+
margin-top: auto;
|
|
413
|
+
padding-top: 4px;
|
|
414
|
+
}
|
|
415
|
+
code.cli-hint {
|
|
416
|
+
background: var(--bg);
|
|
417
|
+
border: 1px solid var(--border);
|
|
418
|
+
border-radius: 6px;
|
|
419
|
+
padding: 4px 8px;
|
|
420
|
+
font-size: 0.76rem;
|
|
421
|
+
color: #93c5fd;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/* ── Fonts Grid ── */
|
|
425
|
+
.fonts-grid {
|
|
426
|
+
display: grid;
|
|
427
|
+
grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
|
|
428
|
+
gap: 14px;
|
|
429
|
+
}
|
|
430
|
+
.font-card {
|
|
431
|
+
background: var(--panel);
|
|
432
|
+
border: 1px solid var(--border);
|
|
433
|
+
border-radius: 12px;
|
|
434
|
+
padding: 15px;
|
|
435
|
+
display: flex;
|
|
436
|
+
flex-direction: column;
|
|
437
|
+
gap: 10px;
|
|
438
|
+
}
|
|
439
|
+
.font-card.is-editor { border-color: var(--accent); }
|
|
440
|
+
.font-card.is-tab { box-shadow: inset 0 0 0 1px var(--purple); }
|
|
441
|
+
.fc-head {
|
|
442
|
+
display: flex;
|
|
443
|
+
justify-content: space-between;
|
|
444
|
+
align-items: center;
|
|
445
|
+
gap: 8px;
|
|
446
|
+
}
|
|
447
|
+
.fc-name { font-weight: 700; font-size: 0.96rem; }
|
|
448
|
+
.fc-badges { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
|
|
449
|
+
.f-badge {
|
|
450
|
+
font-size: 0.66rem;
|
|
451
|
+
font-weight: 700;
|
|
452
|
+
padding: 2px 6px;
|
|
453
|
+
border-radius: 4px;
|
|
454
|
+
text-transform: uppercase;
|
|
455
|
+
}
|
|
456
|
+
.f-badge.ed { background: rgba(96, 165, 250, 0.2); color: var(--accent); }
|
|
457
|
+
.f-badge.tb { background: rgba(192, 132, 252, 0.2); color: var(--purple); }
|
|
458
|
+
.f-badge.nf { background: rgba(52, 211, 153, 0.16); color: var(--green); }
|
|
459
|
+
.f-author { font-size: 0.73rem; color: var(--sub); }
|
|
460
|
+
.fc-sample {
|
|
461
|
+
font-size: 0.85rem;
|
|
462
|
+
color: var(--sub);
|
|
463
|
+
line-height: 1.45;
|
|
464
|
+
}
|
|
465
|
+
.fc-code {
|
|
466
|
+
background: var(--bg);
|
|
467
|
+
border: 1px solid var(--border);
|
|
468
|
+
border-radius: 7px;
|
|
469
|
+
padding: 8px 10px;
|
|
470
|
+
font-size: 0.86rem;
|
|
471
|
+
overflow-x: auto;
|
|
472
|
+
white-space: pre;
|
|
473
|
+
}
|
|
474
|
+
.fc-icons {
|
|
475
|
+
font-size: 0.95rem;
|
|
476
|
+
color: var(--accent);
|
|
477
|
+
letter-spacing: 0.18em;
|
|
478
|
+
}
|
|
479
|
+
.fc-actions {
|
|
480
|
+
display: flex;
|
|
481
|
+
gap: 8px;
|
|
482
|
+
margin-top: auto;
|
|
483
|
+
}
|
|
484
|
+
.fc-actions button { flex: 1; }
|
|
485
|
+
|
|
486
|
+
/* ── Appearance & Settings Cards ── */
|
|
487
|
+
.settings-grid {
|
|
488
|
+
display: grid;
|
|
489
|
+
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
|
|
490
|
+
gap: 16px;
|
|
491
|
+
}
|
|
492
|
+
.s-card {
|
|
493
|
+
background: var(--panel);
|
|
494
|
+
border: 1px solid var(--border);
|
|
495
|
+
border-radius: 12px;
|
|
496
|
+
padding: 18px;
|
|
497
|
+
display: flex;
|
|
498
|
+
flex-direction: column;
|
|
499
|
+
gap: 14px;
|
|
500
|
+
}
|
|
501
|
+
.s-card h3 {
|
|
502
|
+
font-size: 0.95rem;
|
|
503
|
+
color: var(--accent);
|
|
504
|
+
border-bottom: 1px solid var(--border);
|
|
505
|
+
padding-bottom: 8px;
|
|
506
|
+
}
|
|
507
|
+
.s-row {
|
|
508
|
+
display: flex;
|
|
509
|
+
justify-content: space-between;
|
|
510
|
+
align-items: center;
|
|
511
|
+
gap: 12px;
|
|
512
|
+
font-size: 0.85rem;
|
|
513
|
+
}
|
|
514
|
+
.s-row label { color: var(--sub); }
|
|
515
|
+
.s-row input[type="number"],
|
|
516
|
+
.s-row input[type="text"],
|
|
517
|
+
.s-row select {
|
|
518
|
+
background: var(--panel2);
|
|
519
|
+
color: var(--text);
|
|
520
|
+
border: 1px solid var(--border);
|
|
521
|
+
border-radius: 6px;
|
|
522
|
+
padding: 6px 9px;
|
|
523
|
+
font-size: 0.83rem;
|
|
524
|
+
min-width: 180px;
|
|
525
|
+
}
|
|
526
|
+
.chips-wrap {
|
|
527
|
+
display: flex;
|
|
528
|
+
flex-wrap: wrap;
|
|
529
|
+
gap: 6px;
|
|
530
|
+
}
|
|
531
|
+
.scheme-chip {
|
|
532
|
+
background: var(--panel2);
|
|
533
|
+
border: 1px solid var(--border);
|
|
534
|
+
color: var(--sub);
|
|
535
|
+
border-radius: 999px;
|
|
536
|
+
padding: 4px 10px;
|
|
537
|
+
font-size: 0.75rem;
|
|
538
|
+
cursor: pointer;
|
|
539
|
+
}
|
|
540
|
+
.scheme-chip.active, .scheme-chip:hover {
|
|
541
|
+
border-color: var(--accent);
|
|
542
|
+
color: #fff;
|
|
543
|
+
background: rgba(96, 165, 250, 0.16);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/* Backups & Presets */
|
|
547
|
+
.bkp-list {
|
|
548
|
+
display: flex;
|
|
549
|
+
flex-direction: column;
|
|
550
|
+
gap: 8px;
|
|
551
|
+
max-height: 420px;
|
|
552
|
+
overflow-y: auto;
|
|
553
|
+
}
|
|
554
|
+
.bkp-item {
|
|
555
|
+
display: flex;
|
|
556
|
+
justify-content: space-between;
|
|
557
|
+
align-items: center;
|
|
558
|
+
gap: 10px;
|
|
559
|
+
background: var(--bg);
|
|
560
|
+
border: 1px solid var(--border);
|
|
561
|
+
border-radius: 8px;
|
|
562
|
+
padding: 10px 12px;
|
|
563
|
+
font-size: 0.82rem;
|
|
564
|
+
}
|
|
565
|
+
.preset-area {
|
|
566
|
+
width: 100%;
|
|
567
|
+
min-height: 170px;
|
|
568
|
+
background: var(--bg);
|
|
569
|
+
color: var(--text);
|
|
570
|
+
border: 1px solid var(--border);
|
|
571
|
+
border-radius: 8px;
|
|
572
|
+
padding: 10px;
|
|
573
|
+
font-family: ui-monospace, monospace;
|
|
574
|
+
font-size: 0.8rem;
|
|
575
|
+
resize: vertical;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
@media (max-width: 680px) {
|
|
579
|
+
.themes-grid, .fonts-grid, .settings-grid { grid-template-columns: 1fr; }
|
|
580
|
+
.studio-header { padding: 12px 14px 0; }
|
|
581
|
+
.container { padding: 0 14px; }
|
|
582
|
+
}
|
|
583
|
+
</style>
|
|
584
|
+
</head>
|
|
585
|
+
<body>
|
|
586
|
+
<header class="studio-header">
|
|
587
|
+
<div class="header-inner">
|
|
588
|
+
<div class="header-top">
|
|
589
|
+
<div class="brand">
|
|
590
|
+
<h1>✦ WezTerm Studio</h1>
|
|
591
|
+
<span class="mode-pill" id="modePill">Loading...</span>
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
<div class="init-banner" id="initBanner">
|
|
595
|
+
<span>Your <code>wezterm.lua</code> is not linked yet.</span>
|
|
596
|
+
<button id="initBtn">⚡ Integrate Now (init)</button>
|
|
597
|
+
</div>
|
|
598
|
+
|
|
599
|
+
<div class="quick-strip">
|
|
600
|
+
<div class="q-box">
|
|
601
|
+
<span class="q-label theme">Tabs</span>
|
|
602
|
+
<span class="q-val" id="hdrTheme">—</span>
|
|
603
|
+
</div>
|
|
604
|
+
|
|
605
|
+
<div class="q-box">
|
|
606
|
+
<span class="q-label editor">Editor</span>
|
|
607
|
+
<span class="q-val" id="hdrEditorFont">Default</span>
|
|
608
|
+
<select class="q-select" id="hdrEditorWeight">
|
|
609
|
+
<option>Thin</option><option>Light</option><option selected>Regular</option>
|
|
610
|
+
<option>Medium</option><option>DemiBold</option><option>Bold</option>
|
|
611
|
+
</select>
|
|
612
|
+
<div class="stepper">
|
|
613
|
+
<button id="edDec" title="Decrease">−</button>
|
|
614
|
+
<input id="hdrEditorSize" type="text" value="13">
|
|
615
|
+
<button id="edInc" title="Increase">+</button>
|
|
616
|
+
</div>
|
|
617
|
+
</div>
|
|
618
|
+
|
|
619
|
+
<div class="q-box">
|
|
620
|
+
<span class="q-label tab">Tab Font</span>
|
|
621
|
+
<span class="q-val" id="hdrTabFont">Default</span>
|
|
622
|
+
<select class="q-select" id="hdrTabWeight">
|
|
623
|
+
<option>Regular</option><option selected>Medium</option><option>DemiBold</option><option>Bold</option>
|
|
624
|
+
</select>
|
|
625
|
+
<div class="stepper">
|
|
626
|
+
<button id="tbDec" title="Decrease">−</button>
|
|
627
|
+
<input id="hdrTabSize" type="text" value="11">
|
|
628
|
+
<button id="tbInc" title="Increase">+</button>
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
</div>
|
|
632
|
+
|
|
633
|
+
<div class="status-pill" id="statusPill">Ready</div>
|
|
634
|
+
</div>
|
|
635
|
+
|
|
636
|
+
<nav class="nav-tabs">
|
|
637
|
+
<button class="nav-tab active" data-view="themes">🎨 Tab Bar Themes (60)</button>
|
|
638
|
+
<button class="nav-tab" data-view="fonts">🔤 Fonts & Typography</button>
|
|
639
|
+
<button class="nav-tab" data-view="appearance">🖥 Colors, Window & Cursor</button>
|
|
640
|
+
<button class="nav-tab" data-view="backups">💾 Backups & Presets</button>
|
|
641
|
+
</nav>
|
|
642
|
+
</div>
|
|
643
|
+
</header>
|
|
644
|
+
|
|
645
|
+
<main class="container">
|
|
646
|
+
<!-- ── TAB 1: 60 TAB THEMES & SYMBOLS ── -->
|
|
647
|
+
<section class="view-pane active" id="view-themes">
|
|
648
|
+
<div class="toolbar">
|
|
649
|
+
<input class="search-input" id="themeSearch" type="search" placeholder="Search themes by name, category, style, or #ID (e.g. neon, powerline, catppuccin, #08)...">
|
|
650
|
+
<label style="display:flex;align-items:center;gap:8px;font-size:0.83rem;color:var(--sub);">
|
|
651
|
+
Fixed width (<strong id="lenLabel" style="color:var(--text)">15</strong>c):
|
|
652
|
+
<input id="lenSlider" type="range" min="4" max="32" value="15">
|
|
653
|
+
</label>
|
|
654
|
+
<button class="btn btn-purple" id="toggleSymBtn">✦ Tab Symbols</button>
|
|
655
|
+
<button class="btn" id="randomThemeBtn">🎲 Random</button>
|
|
656
|
+
<span id="themeCount" style="color:var(--sub);font-size:0.82rem;"></span>
|
|
657
|
+
</div>
|
|
658
|
+
|
|
659
|
+
<!-- Collapsible Symbol Customizer -->
|
|
660
|
+
<div class="sym-drawer" id="symDrawer">
|
|
661
|
+
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;flex-wrap:wrap;gap:8px;">
|
|
662
|
+
<div>
|
|
663
|
+
<strong>✦ Tab Bar Symbol Builder</strong>
|
|
664
|
+
<span id="symStateLabel" style="margin-left:8px;font-size:0.78rem;color:var(--sub);"></span>
|
|
665
|
+
</div>
|
|
666
|
+
<div style="display:flex;gap:8px;">
|
|
667
|
+
<button class="btn" id="resetSymBtn">↺ Use Theme Defaults</button>
|
|
668
|
+
<button class="btn btn-primary" id="applySymBtn">✔ Apply Symbols to WezTerm</button>
|
|
669
|
+
</div>
|
|
670
|
+
</div>
|
|
671
|
+
<div class="sym-preview-box" id="symPreviewBox"></div>
|
|
672
|
+
<div class="sym-groups" id="symGroupsBox"></div>
|
|
673
|
+
</div>
|
|
674
|
+
|
|
675
|
+
<div class="pills-row" id="catPills"></div>
|
|
676
|
+
<div class="themes-grid" id="themesGrid"></div>
|
|
677
|
+
</section>
|
|
678
|
+
|
|
679
|
+
<!-- ── TAB 2: FONTS & TYPOGRAPHY ── -->
|
|
680
|
+
<section class="view-pane" id="view-fonts">
|
|
681
|
+
<div class="toolbar">
|
|
682
|
+
<input class="search-input" id="fontSearch" type="search" placeholder="Search fonts by family or designer (e.g. Victor, JetBrains, Iosevka, Cascadia, Meslo)...">
|
|
683
|
+
<button class="pill-btn active" id="filterAllFonts">All Fonts</button>
|
|
684
|
+
<button class="pill-btn" id="filterNerdFonts">Nerd Fonts Only</button>
|
|
685
|
+
<button class="btn" id="refreshFontsBtn">↻ Reload System Fonts</button>
|
|
686
|
+
<span id="fontCount" style="color:var(--sub);font-size:0.82rem;"></span>
|
|
687
|
+
</div>
|
|
688
|
+
<div class="fonts-grid" id="fontsGrid"></div>
|
|
689
|
+
</section>
|
|
690
|
+
|
|
691
|
+
<!-- ── TAB 3: COLORS, WINDOW & CURSOR ── -->
|
|
692
|
+
<section class="view-pane" id="view-appearance">
|
|
693
|
+
<div class="settings-grid">
|
|
694
|
+
<div class="s-card">
|
|
695
|
+
<h3>🎨 Terminal Color Scheme</h3>
|
|
696
|
+
<div class="s-row">
|
|
697
|
+
<label for="schemeInput">Active scheme</label>
|
|
698
|
+
<div style="display:flex;gap:6px;flex:1;justify-content:flex-end;">
|
|
699
|
+
<input id="schemeInput" list="schemesDatalist" type="text" placeholder="e.g. Monokai Vivid, Catppuccin Mocha...">
|
|
700
|
+
<datalist id="schemesDatalist"></datalist>
|
|
701
|
+
<button class="btn btn-primary" id="applySchemeBtn">Apply</button>
|
|
702
|
+
<button class="btn" id="resetSchemeBtn" title="Reset to WezTerm default">Default</button>
|
|
703
|
+
</div>
|
|
704
|
+
</div>
|
|
705
|
+
<div>
|
|
706
|
+
<div style="font-size:0.76rem;color:var(--sub);margin-bottom:8px;">Quick favorites (1-click):</div>
|
|
707
|
+
<div class="chips-wrap" id="quickSchemes"></div>
|
|
708
|
+
</div>
|
|
709
|
+
</div>
|
|
710
|
+
|
|
711
|
+
<div class="s-card">
|
|
712
|
+
<h3>🪟 Window & Opacity</h3>
|
|
713
|
+
<div class="s-row">
|
|
714
|
+
<label for="opacityRange">Background opacity (<span id="opacityVal">1.00</span>)</label>
|
|
715
|
+
<input id="opacityRange" type="range" min="0.2" max="1.0" step="0.02" value="1.0">
|
|
716
|
+
</div>
|
|
717
|
+
<div class="s-row">
|
|
718
|
+
<label for="paddingInput">Window padding (px)</label>
|
|
719
|
+
<input id="paddingInput" type="number" min="0" max="64" step="2" value="10">
|
|
720
|
+
</div>
|
|
721
|
+
<div class="s-row">
|
|
722
|
+
<label for="decorationsSelect">Window decorations</label>
|
|
723
|
+
<select id="decorationsSelect">
|
|
724
|
+
<option value="INTEGRATED_BUTTONS | RESIZE">INTEGRATED_BUTTONS | RESIZE</option>
|
|
725
|
+
<option value="TITLE | RESIZE">TITLE | RESIZE</option>
|
|
726
|
+
<option value="RESIZE">RESIZE (No title bar)</option>
|
|
727
|
+
<option value="NONE">NONE (Borderless)</option>
|
|
728
|
+
</select>
|
|
729
|
+
</div>
|
|
730
|
+
<div class="s-row">
|
|
731
|
+
<label for="lineHeightInput">Line height</label>
|
|
732
|
+
<input id="lineHeightInput" type="number" min="0.8" max="2.0" step="0.05" value="1.0">
|
|
733
|
+
</div>
|
|
734
|
+
</div>
|
|
735
|
+
|
|
736
|
+
<div class="s-card">
|
|
737
|
+
<h3>▏Cursor, Tab Bar & Performance</h3>
|
|
738
|
+
<div class="s-row">
|
|
739
|
+
<label for="cursorStyleSelect">Cursor style</label>
|
|
740
|
+
<select id="cursorStyleSelect">
|
|
741
|
+
<option value="BlinkingBar">BlinkingBar</option>
|
|
742
|
+
<option value="SteadyBar">SteadyBar</option>
|
|
743
|
+
<option value="BlinkingBlock">BlinkingBlock</option>
|
|
744
|
+
<option value="SteadyBlock">SteadyBlock</option>
|
|
745
|
+
<option value="BlinkingUnderline">BlinkingUnderline</option>
|
|
746
|
+
<option value="SteadyUnderline">SteadyUnderline</option>
|
|
747
|
+
</select>
|
|
748
|
+
</div>
|
|
749
|
+
<div class="s-row">
|
|
750
|
+
<label for="cursorBlinkInput">Cursor blink rate (ms)</label>
|
|
751
|
+
<input id="cursorBlinkInput" type="number" min="0" max="2000" step="50" value="500">
|
|
752
|
+
</div>
|
|
753
|
+
<div class="s-row">
|
|
754
|
+
<label for="scrollbackInput">Scrollback lines</label>
|
|
755
|
+
<input id="scrollbackInput" type="number" min="500" max="200000" step="500" value="5000">
|
|
756
|
+
</div>
|
|
757
|
+
<div class="s-row">
|
|
758
|
+
<label for="tabBottomCheck">Place tab bar at bottom</label>
|
|
759
|
+
<input id="tabBottomCheck" type="checkbox" checked>
|
|
760
|
+
</div>
|
|
761
|
+
<div class="s-row">
|
|
762
|
+
<label for="hideOneTabCheck">Hide tab bar when only one tab is open</label>
|
|
763
|
+
<input id="hideOneTabCheck" type="checkbox">
|
|
764
|
+
</div>
|
|
765
|
+
<div class="s-row">
|
|
766
|
+
<label for="bellCheck">Audible bell</label>
|
|
767
|
+
<input id="bellCheck" type="checkbox">
|
|
768
|
+
</div>
|
|
769
|
+
</div>
|
|
770
|
+
</div>
|
|
771
|
+
</section>
|
|
772
|
+
|
|
773
|
+
<!-- ── TAB 4: BACKUPS & PRESETS ── -->
|
|
774
|
+
<section class="view-pane" id="view-backups">
|
|
775
|
+
<div class="settings-grid">
|
|
776
|
+
<div class="s-card">
|
|
777
|
+
<h3>💾 Instant Backups</h3>
|
|
778
|
+
<div style="display:flex;gap:8px;">
|
|
779
|
+
<input class="search-input" id="backupLabelInput" type="text" placeholder="Optional label (e.g. before_test)...">
|
|
780
|
+
<button class="btn btn-primary" id="createBackupBtn">+ Save Backup</button>
|
|
781
|
+
</div>
|
|
782
|
+
<div class="bkp-list" id="backupsList"></div>
|
|
783
|
+
</div>
|
|
784
|
+
|
|
785
|
+
<div class="s-card">
|
|
786
|
+
<h3>📦 Portable Preset (Linux · macOS · Windows)</h3>
|
|
787
|
+
<p style="font-size:0.81rem;color:var(--sub);">
|
|
788
|
+
Export or import your full setup (tab theme, symbols, fonts, color scheme, and window settings) as JSON.
|
|
789
|
+
</p>
|
|
790
|
+
<div style="display:flex;gap:8px;flex-wrap:wrap;">
|
|
791
|
+
<button class="btn" id="loadExportBtn">⬇ Load Current Setup</button>
|
|
792
|
+
<button class="btn" id="downloadPresetBtn">💾 Download .json</button>
|
|
793
|
+
<button class="btn btn-primary" id="importPresetBtn">⚡ Apply JSON Below</button>
|
|
794
|
+
</div>
|
|
795
|
+
<textarea class="preset-area" id="presetTextarea" placeholder='Click "Load Current Setup" or paste a preset JSON here...'></textarea>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
</section>
|
|
799
|
+
</main>
|
|
800
|
+
|
|
801
|
+
<script>
|
|
802
|
+
let BOOT = null;
|
|
803
|
+
let STATE = null;
|
|
804
|
+
let FONTS = [];
|
|
805
|
+
let curCat = "";
|
|
806
|
+
let onlyNerd = false;
|
|
807
|
+
let draftSymbols = null;
|
|
808
|
+
|
|
809
|
+
const QUICK_SCHEMES = [
|
|
810
|
+
"Monokai Vivid", "Catppuccin Mocha", "Catppuccin Macchiato", "Tokyo Night",
|
|
811
|
+
"Tokyo Night Storm", "Dracula", "Gruvbox Dark (Gogh)", "Kanagawa (Gogh)",
|
|
812
|
+
"Nord", "Everforest Dark (Gogh)", "rose-pine", "SynthWave 84"
|
|
813
|
+
];
|
|
814
|
+
|
|
815
|
+
const EMOJI_COLORS = {
|
|
816
|
+
red: "#e53935", orange: "#fb8c00", yellow: "#fdd835", green: "#43a047",
|
|
817
|
+
blue: "#1e88e5", purple: "#8e24aa", black: "#212121", white: "#eeeeee"
|
|
818
|
+
};
|
|
819
|
+
const MATCH_MAPS = {
|
|
820
|
+
balls: { red: "🔴", orange: "🟠", yellow: "🟡", green: "🟢", blue: "🔵", purple: "🟣", black: "⚫", white: "⚪" },
|
|
821
|
+
squares: { red: "🟥", orange: "🟧", yellow: "🟨", green: "🟩", blue: "🟦", purple: "🟪", black: "⬛", white: "⬜" },
|
|
822
|
+
hearts: { orange: "🧡", yellow: "💛", green: "💚", blue: "💙", purple: "💜", black: "🖤", white: "🤍" }
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
function setStatus(msg, kind = "") {
|
|
826
|
+
const el = document.getElementById("statusPill");
|
|
827
|
+
el.textContent = msg;
|
|
828
|
+
el.className = "status-pill" + (kind ? " " + kind : "");
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
async function apiGet(url) {
|
|
832
|
+
const res = await fetch(url);
|
|
833
|
+
return await res.json();
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
async function apiPost(url, payload = {}) {
|
|
837
|
+
const res = await fetch(url, {
|
|
838
|
+
method: "POST",
|
|
839
|
+
headers: { "Content-Type": "application/json" },
|
|
840
|
+
body: JSON.stringify(payload)
|
|
841
|
+
});
|
|
842
|
+
return await res.json();
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
function esc(s) {
|
|
846
|
+
return String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
function lchFromHex(hex) {
|
|
850
|
+
const h = hex.replace("#", "");
|
|
851
|
+
const rgb = [0, 2, 4].map(i => parseInt(h.slice(i, i + 2), 16) / 255);
|
|
852
|
+
const [r, g, b] = rgb.map(c => c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
853
|
+
const xyz = [
|
|
854
|
+
(0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.95047,
|
|
855
|
+
(0.2126 * r + 0.7152 * g + 0.0722 * b),
|
|
856
|
+
(0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883
|
|
857
|
+
];
|
|
858
|
+
const [fx, fy, fz] = xyz.map(t => t > 0.008856 ? Math.cbrt(t) : 7.787 * t + 16 / 116);
|
|
859
|
+
const a = 500 * (fx - fy), bb = 200 * (fy - fz);
|
|
860
|
+
return [116 * fy - 16, Math.hypot(a, bb), ((Math.atan2(bb, a) * 180 / Math.PI) + 360) % 360];
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
function matchGlyph(mapKey, bg) {
|
|
864
|
+
const glyphs = MATCH_MAPS[mapKey];
|
|
865
|
+
const [light, chroma, hue] = lchFromHex(bg);
|
|
866
|
+
if (chroma < 12) {
|
|
867
|
+
const gray = light < 50 ? "black" : "white";
|
|
868
|
+
if (glyphs[gray]) return glyphs[gray];
|
|
869
|
+
}
|
|
870
|
+
let best = Object.keys(glyphs)[0], bestGap = 9999;
|
|
871
|
+
for (const name of Object.keys(glyphs)) {
|
|
872
|
+
const [, c, h] = lchFromHex(EMOJI_COLORS[name]);
|
|
873
|
+
const raw = Math.abs(h - hue) % 360;
|
|
874
|
+
const gap = c >= 12 ? Math.min(raw, 360 - raw) : 999;
|
|
875
|
+
if (gap < bestGap) { bestGap = gap; best = name; }
|
|
876
|
+
}
|
|
877
|
+
return glyphs[best];
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
function composeSymbolsJS(sel, i, bg) {
|
|
881
|
+
const merged = Object.assign({}, BOOT.default_symbols, sel);
|
|
882
|
+
const findOpt = (gKey, k) => {
|
|
883
|
+
const g = BOOT.symbol_groups.find(x => x.key === gKey);
|
|
884
|
+
return g.options.find(o => o.key === k) || g.options[0];
|
|
885
|
+
};
|
|
886
|
+
const pOpt = findOpt("prefix", merged.prefix);
|
|
887
|
+
const mOpt = findOpt("marker", merged.marker);
|
|
888
|
+
const aOpt = findOpt("arrow", merged.arrow);
|
|
889
|
+
const iOpt = findOpt("inactive", merged.inactive);
|
|
890
|
+
|
|
891
|
+
const glyph = (opt) => {
|
|
892
|
+
const arr = opt.chars || [""];
|
|
893
|
+
return arr[i % arr.length] || "";
|
|
894
|
+
};
|
|
895
|
+
const marker = (MATCH_MAPS[mOpt.key] && bg) ? matchGlyph(mOpt.key, bg) : glyph(mOpt);
|
|
896
|
+
const parts = [glyph(pOpt), marker, glyph(aOpt)].filter(Boolean);
|
|
897
|
+
const active = parts.length ? parts.join(" ") + " " : "";
|
|
898
|
+
const inactChar = iOpt.chars === null ? marker : glyph(iOpt);
|
|
899
|
+
return [active, inactChar ? " " + inactChar : ""];
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
function withSymbols(theme, sel) {
|
|
903
|
+
if (!sel) return theme;
|
|
904
|
+
const palette = theme.palette.map((p, idx) => {
|
|
905
|
+
const [active_sym, inactive_sym] = composeSymbolsJS(sel, idx, p.bg);
|
|
906
|
+
return Object.assign({}, p, { active_sym, inactive_sym });
|
|
907
|
+
});
|
|
908
|
+
return Object.assign({}, theme, { palette });
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
function fmtFixed(txt, len) {
|
|
912
|
+
if (txt.length > len) return len <= 1 ? "…" : txt.slice(0, len - 1) + "…";
|
|
913
|
+
return txt + " ".repeat(len - txt.length);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function projectSlot(name, size) {
|
|
917
|
+
let h = 0;
|
|
918
|
+
for (let i = 0; i < name.length; i++) h = (h * 31 + name.charCodeAt(i)) % 2147483648;
|
|
919
|
+
return h % size;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
function seg(bg, fg, text, bold, underline, pill) {
|
|
923
|
+
const st = `background:${bg};color:${fg};${bold ? "font-weight:700;" : ""}${underline ? "text-decoration:underline;" : ""}`;
|
|
924
|
+
return `<span class="tab-seg${pill ? " tab-pill" : ""}" style="${st}">${esc(text)}</span>`;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
function renderBarHTML(rawTheme, len, symOverride) {
|
|
928
|
+
const t = withSymbols(rawTheme, symOverride);
|
|
929
|
+
const p = t.palette;
|
|
930
|
+
const pill = !!t.use_fancy && t.style !== "powerline";
|
|
931
|
+
const names = ["setup", "workspace", "backend", "cloud-run"].map(n => fmtFixed(n, len));
|
|
932
|
+
const s = t.style;
|
|
933
|
+
|
|
934
|
+
if (s === "powerline") {
|
|
935
|
+
const sep = t.sep_char || "\ue0b0";
|
|
936
|
+
let out = "";
|
|
937
|
+
for (let i = 0; i < 4; i++) {
|
|
938
|
+
const c = p[i];
|
|
939
|
+
const nextBg = i < 3 ? p[i + 1].bg : t.bg_bar;
|
|
940
|
+
const pre = i === 0 ? `${c.active_sym || "⚡ "}1` : `${i + 1}${c.inactive_sym || ""}`;
|
|
941
|
+
out += seg(c.bg, c.fg, ` ${pre} ${names[i]} `, i === 0, i === 0, false);
|
|
942
|
+
out += seg(nextBg, c.bg, sep, false, false, false);
|
|
943
|
+
}
|
|
944
|
+
return out;
|
|
945
|
+
}
|
|
946
|
+
if (s === "crt_amber") {
|
|
947
|
+
return [0,1,2,3].map(i => seg(p[i].bg, p[i].fg, ` [${i===0?"*":"-"} 0${i+1}:${names[i].toUpperCase()} ${i===0?"*":"-"}] `, i===0, i===0, pill)).join("");
|
|
948
|
+
}
|
|
949
|
+
if (s === "left_bar") {
|
|
950
|
+
return [0,1,2,3].map(i => seg(i===0?p[i].bg:"#1a1c23", i===0?p[i].fg:p[i].bg, `${i===0?"▌ ":" "}${i+1} ${names[i]} ✕ `, i===0, i===0, pill)).join("");
|
|
951
|
+
}
|
|
952
|
+
if (s === "top_neon") {
|
|
953
|
+
return [0,1,2,3].map(i => seg(i===0?p[i].bg:"#151720", i===0?p[i].fg:p[i].bg, ` ▔ ${i+1} ${names[i]} ✕ `, i===0, i===0, pill)).join("");
|
|
954
|
+
}
|
|
955
|
+
if (s === "ghost") {
|
|
956
|
+
return [0,1,2,3].map(i => seg(i===0?"#252836":t.bg_bar, p[i].bg, ` ${i+1} ${names[i]} ✕ `, i===0, i===0, pill)).join("");
|
|
957
|
+
}
|
|
958
|
+
if (s === "outline") {
|
|
959
|
+
return [0,1,2,3].map(i => seg(i===0?p[i].bg:"#161822", i===0?p[i].fg:p[i].bg, ` ${i===0?"【":"〔"}${i+1} ${names[i]}${i===0?"】":"〕"} `, i===0, i===0, pill)).join("");
|
|
960
|
+
}
|
|
961
|
+
if (s === "circle_numbers") {
|
|
962
|
+
const cc = ["❶","❷","❸","❹"];
|
|
963
|
+
return [0,1,2,3].map(i => seg(p[i].bg, p[i].fg, ` ${cc[i]} ${names[i]} ✕ `, i===0, i===0, pill)).join("");
|
|
964
|
+
}
|
|
965
|
+
if (s === "smart_badges") {
|
|
966
|
+
const ic = ["","","",""];
|
|
967
|
+
return [0,1,2,3].map(i => seg(p[i].bg, p[i].fg, ` ${ic[i]} ${i+1} ${names[i]} ✕ `, i===0, i===0, pill)).join("");
|
|
968
|
+
}
|
|
969
|
+
if (s === "pulse_dots") {
|
|
970
|
+
return [0,1,2,3].map(i => seg(p[i].bg, p[i].fg, ` ${i===0?(p[i].active_sym||""):(p[i].inactive_sym||"")}${i+1} ${names[i]} ✕ `, i===0, i===0, pill)).join("");
|
|
971
|
+
}
|
|
972
|
+
if (s === "mono_accent") {
|
|
973
|
+
return [0,1,2,3].map(i => i === 0
|
|
974
|
+
? seg(p[0].bg, p[0].fg, ` ${p[0].active_sym||""}1 ${names[0]} ✕ `, true, false, pill)
|
|
975
|
+
: seg(t.muted_bg || "#303134", t.muted_fg || "#9aa0a6", ` ${i+1}${p[i].inactive_sym||""} ${names[i]} ✕ `, false, false, pill)
|
|
976
|
+
).join("");
|
|
977
|
+
}
|
|
978
|
+
if (s === "project_color") {
|
|
979
|
+
const pnames = ["backend", "wezterm-studio", "backend", "infra"];
|
|
980
|
+
return pnames.map((nm, i) => {
|
|
981
|
+
const c = p[projectSlot(nm, p.length)];
|
|
982
|
+
const tx = i === 0 ? `${c.active_sym||""}1` : `${i+1}${c.inactive_sym||""}`;
|
|
983
|
+
return seg(c.bg, c.fg, ` ${tx} ${fmtFixed(nm, len)} ✕ `, i===0, i===0, pill);
|
|
984
|
+
}).join("");
|
|
985
|
+
}
|
|
986
|
+
return [0,1,2,3].map(i => {
|
|
987
|
+
const c = p[i];
|
|
988
|
+
const tx = i === 0 ? `${c.active_sym||"⚡ ➜ "}1` : `${i+1}${c.inactive_sym||" 🔘"}`;
|
|
989
|
+
return seg(c.bg, c.fg, ` ${tx} ${names[i]} ✕ `, i===0, i===0, pill);
|
|
990
|
+
}).join("");
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function shortFont(f) {
|
|
994
|
+
return f ? f.replace(/ Nerd Font( Mono| Propo)?$/, " NF") : "Default";
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function syncHeaderAndAppearanceUI() {
|
|
998
|
+
if (!STATE) return;
|
|
999
|
+
const app = STATE.appearance || {};
|
|
1000
|
+
const activeTheme = BOOT.themes.find(t => t.id === STATE.theme_id) || BOOT.themes[0];
|
|
1001
|
+
|
|
1002
|
+
document.getElementById("modePill").textContent = `${STATE.platform} · ${STATE.mode}`;
|
|
1003
|
+
document.getElementById("initBanner").classList.toggle("visible", !STATE.initialized);
|
|
1004
|
+
|
|
1005
|
+
document.getElementById("hdrTheme").textContent = `#${String(activeTheme.id).padStart(2, "0")} ${activeTheme.name}`;
|
|
1006
|
+
document.getElementById("hdrEditorFont").textContent = shortFont(app.font_family);
|
|
1007
|
+
document.getElementById("hdrTabFont").textContent = shortFont(app.tab_font_family);
|
|
1008
|
+
|
|
1009
|
+
if (app.font_weight) document.getElementById("hdrEditorWeight").value = app.font_weight;
|
|
1010
|
+
if (app.font_size != null) document.getElementById("hdrEditorSize").value = app.font_size;
|
|
1011
|
+
if (app.tab_font_weight) document.getElementById("hdrTabWeight").value = app.tab_font_weight;
|
|
1012
|
+
if (app.tab_font_size != null) document.getElementById("hdrTabSize").value = app.tab_font_size;
|
|
1013
|
+
|
|
1014
|
+
if (app.tab_font_family) {
|
|
1015
|
+
document.documentElement.style.setProperty("--tab-preview-font", `"${app.tab_font_family}", "JetBrains Mono", monospace`);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
document.getElementById("lenSlider").value = Math.min(32, Math.max(4, STATE.tab_title_len || 15));
|
|
1019
|
+
document.getElementById("lenLabel").textContent = STATE.tab_title_len || 15;
|
|
1020
|
+
|
|
1021
|
+
// Appearance controls
|
|
1022
|
+
document.getElementById("schemeInput").value = app.color_scheme || "";
|
|
1023
|
+
document.querySelectorAll(".scheme-chip").forEach(ch => {
|
|
1024
|
+
ch.classList.toggle("active", ch.dataset.scheme === (app.color_scheme || ""));
|
|
1025
|
+
});
|
|
1026
|
+
if (app.window_opacity != null) {
|
|
1027
|
+
document.getElementById("opacityRange").value = app.window_opacity;
|
|
1028
|
+
document.getElementById("opacityVal").textContent = Number(app.window_opacity).toFixed(2);
|
|
1029
|
+
}
|
|
1030
|
+
if (app.window_padding != null && typeof app.window_padding === "number") {
|
|
1031
|
+
document.getElementById("paddingInput").value = app.window_padding;
|
|
1032
|
+
}
|
|
1033
|
+
if (app.window_decorations) document.getElementById("decorationsSelect").value = app.window_decorations;
|
|
1034
|
+
if (app.line_height != null) document.getElementById("lineHeightInput").value = app.line_height;
|
|
1035
|
+
if (app.cursor_style) document.getElementById("cursorStyleSelect").value = app.cursor_style;
|
|
1036
|
+
if (app.cursor_blink_rate != null) document.getElementById("cursorBlinkInput").value = app.cursor_blink_rate;
|
|
1037
|
+
if (app.scrollback_lines != null) document.getElementById("scrollbackInput").value = app.scrollback_lines;
|
|
1038
|
+
document.getElementById("tabBottomCheck").checked = app.tab_bar_at_bottom !== false;
|
|
1039
|
+
document.getElementById("hideOneTabCheck").checked = !!app.hide_tab_bar_if_only_one_tab;
|
|
1040
|
+
document.getElementById("bellCheck").checked = app.audible_bell === "SystemBeep";
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function renderSymbolDrawer() {
|
|
1044
|
+
const curTheme = BOOT.themes.find(t => t.id === STATE.theme_id) || BOOT.themes[0];
|
|
1045
|
+
const len = parseInt(document.getElementById("lenSlider").value, 10) || 15;
|
|
1046
|
+
document.getElementById("symStateLabel").textContent = draftSymbols ? "(Custom)" : "(Theme defaults)";
|
|
1047
|
+
const previewEl = document.getElementById("symPreviewBox");
|
|
1048
|
+
previewEl.style.background = curTheme.bg_bar;
|
|
1049
|
+
previewEl.innerHTML = `<div class="bar-wrap" style="background:${curTheme.bg_bar};border:none;padding:2px;">${renderBarHTML(curTheme, len, draftSymbols)}</div>`;
|
|
1050
|
+
|
|
1051
|
+
const groupsEl = document.getElementById("symGroupsBox");
|
|
1052
|
+
groupsEl.innerHTML = BOOT.symbol_groups.map(g => {
|
|
1053
|
+
const curKey = draftSymbols ? draftSymbols[g.key] : null;
|
|
1054
|
+
const btns = g.options.map(o => {
|
|
1055
|
+
const sample = o.chars === null ? "=" : ((o.chars || []).slice(0, 4).join("") || "—");
|
|
1056
|
+
const sel = curKey === o.key ? " selected" : "";
|
|
1057
|
+
return `<button class="sym-opt${sel}" data-g="${g.key}" data-k="${o.key}">${esc(sample)} ${esc(o.name)}</button>`;
|
|
1058
|
+
}).join("");
|
|
1059
|
+
return `<div class="sym-group"><h4>${esc(g.title)}</h4><div class="sym-opts">${btns}</div></div>`;
|
|
1060
|
+
}).join("");
|
|
1061
|
+
|
|
1062
|
+
groupsEl.querySelectorAll(".sym-opt").forEach(btn => {
|
|
1063
|
+
btn.addEventListener("click", () => {
|
|
1064
|
+
draftSymbols = Object.assign({}, BOOT.default_symbols, draftSymbols || {}, { [btn.dataset.g]: btn.dataset.k });
|
|
1065
|
+
renderSymbolDrawer();
|
|
1066
|
+
renderThemesGrid();
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function renderThemesGrid() {
|
|
1072
|
+
const q = document.getElementById("themeSearch").value.trim().toLowerCase();
|
|
1073
|
+
const numQ = q.replace(/^#/, "");
|
|
1074
|
+
const len = parseInt(document.getElementById("lenSlider").value, 10) || 15;
|
|
1075
|
+
const list = BOOT.themes.filter(t => {
|
|
1076
|
+
if (curCat && t.category !== curCat) return false;
|
|
1077
|
+
if (!q) return true;
|
|
1078
|
+
if (/^\d+$/.test(numQ) && t.id === parseInt(numQ, 10)) return true;
|
|
1079
|
+
return t.name.toLowerCase().includes(q)
|
|
1080
|
+
|| t.category.toLowerCase().includes(q)
|
|
1081
|
+
|| (t.description || "").toLowerCase().includes(q)
|
|
1082
|
+
|| (t.style || "").toLowerCase().includes(q);
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
document.getElementById("themeCount").textContent = `${list.length} of ${BOOT.themes.length} themes`;
|
|
1086
|
+
const grid = document.getElementById("themesGrid");
|
|
1087
|
+
grid.innerHTML = list.map(t => {
|
|
1088
|
+
const idPad = String(t.id).padStart(2, "0");
|
|
1089
|
+
const isAct = t.id === STATE.theme_id;
|
|
1090
|
+
const sw = t.palette.map(p => `<span class="swatch"><span class="dot" style="background:${p.bg}"></span>${p.bg}</span>`).join("");
|
|
1091
|
+
const cmd = `wezterm-theme -s ${t.id}`;
|
|
1092
|
+
return `<article class="theme-card${isAct ? " is-active" : ""}">
|
|
1093
|
+
<div class="tc-head">
|
|
1094
|
+
<div><span class="tc-id">#${idPad}</span><span class="tc-name">${esc(t.name)}</span><span class="tc-cat">[${esc(t.category)}]</span></div>
|
|
1095
|
+
${isAct ? '<span class="active-tag">★ ACTIVE</span>' : ''}
|
|
1096
|
+
</div>
|
|
1097
|
+
<div class="swatches">${sw}</div>
|
|
1098
|
+
<div class="bar-wrap" style="background:${t.bg_bar}">${renderBarHTML(t, len, draftSymbols)}</div>
|
|
1099
|
+
<p class="tc-desc">${esc(t.description)}</p>
|
|
1100
|
+
<div class="tc-foot">
|
|
1101
|
+
<code class="cli-hint">${cmd}</code>
|
|
1102
|
+
<div style="display:flex;gap:6px;">
|
|
1103
|
+
<button class="btn copy-cmd" data-cmd="${cmd}">Copy CLI</button>
|
|
1104
|
+
<button class="btn ${isAct ? 'btn-green' : 'btn-primary'} apply-theme-btn" data-id="${t.id}">
|
|
1105
|
+
${isAct ? '✔ Active' : '⚡ Apply Now'}
|
|
1106
|
+
</button>
|
|
1107
|
+
</div>
|
|
1108
|
+
</div>
|
|
1109
|
+
</article>`;
|
|
1110
|
+
}).join("");
|
|
1111
|
+
|
|
1112
|
+
grid.querySelectorAll(".apply-theme-btn").forEach(btn => {
|
|
1113
|
+
btn.addEventListener("click", async () => {
|
|
1114
|
+
const tid = parseInt(btn.dataset.id, 10);
|
|
1115
|
+
setStatus(`Applying theme #${tid}...`);
|
|
1116
|
+
const res = await apiPost("/api/apply-tab-theme", {
|
|
1117
|
+
theme_id: tid,
|
|
1118
|
+
tab_title_len: len,
|
|
1119
|
+
symbols: draftSymbols
|
|
1120
|
+
});
|
|
1121
|
+
if (res.ok) {
|
|
1122
|
+
STATE = res.state;
|
|
1123
|
+
syncHeaderAndAppearanceUI();
|
|
1124
|
+
renderThemesGrid();
|
|
1125
|
+
renderSymbolDrawer();
|
|
1126
|
+
setStatus("✔ " + res.msg, "ok");
|
|
1127
|
+
} else {
|
|
1128
|
+
setStatus("✖ " + res.msg, "err");
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
grid.querySelectorAll(".copy-cmd").forEach(btn => {
|
|
1134
|
+
btn.addEventListener("click", () => {
|
|
1135
|
+
navigator.clipboard.writeText(btn.dataset.cmd);
|
|
1136
|
+
const old = btn.textContent;
|
|
1137
|
+
btn.textContent = "✔ Copied";
|
|
1138
|
+
setTimeout(() => { btn.textContent = old; }, 1200);
|
|
1139
|
+
});
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
function renderFontsGrid() {
|
|
1144
|
+
const q = document.getElementById("fontSearch").value.trim().toLowerCase();
|
|
1145
|
+
const app = (STATE && STATE.appearance) || {};
|
|
1146
|
+
const list = FONTS.filter(f => {
|
|
1147
|
+
if (onlyNerd && !f.is_nerd) return false;
|
|
1148
|
+
if (!q) return true;
|
|
1149
|
+
return f.name.toLowerCase().includes(q) || (f.desc || "").toLowerCase().includes(q);
|
|
1150
|
+
});
|
|
1151
|
+
document.getElementById("fontCount").textContent = `${list.length} of ${FONTS.length} fonts`;
|
|
1152
|
+
const iconsSample = "⚡ \ue0b0 \ue0b4 \udb80\udea2 \ue73c \udb80\udd69 \uf489 \udb80\udf0e \udb81\udc8b ★ ❶";
|
|
1153
|
+
|
|
1154
|
+
const grid = document.getElementById("fontsGrid");
|
|
1155
|
+
grid.innerHTML = list.map(f => {
|
|
1156
|
+
const isEd = app.font_family === f.family || (app.font_family && app.font_family.startsWith(f.family));
|
|
1157
|
+
const isTb = app.tab_font_family === f.family || (app.tab_font_family && app.tab_font_family.startsWith(f.family));
|
|
1158
|
+
return `<article class="font-card${isEd ? ' is-editor' : ''}${isTb ? ' is-tab' : ''}">
|
|
1159
|
+
<div class="fc-head">
|
|
1160
|
+
<span class="fc-name">${esc(f.name)}</span>
|
|
1161
|
+
<div class="fc-badges">
|
|
1162
|
+
${isEd ? '<span class="f-badge ed">EDITOR</span>' : ''}
|
|
1163
|
+
${isTb ? '<span class="f-badge tb">TABS</span>' : ''}
|
|
1164
|
+
${f.is_nerd ? '<span class="f-badge nf">NERD</span>' : ''}
|
|
1165
|
+
<span class="f-author">${esc(f.desc)}</span>
|
|
1166
|
+
</div>
|
|
1167
|
+
</div>
|
|
1168
|
+
<div class="fc-sample" style="font-family:'${esc(f.family)}',monospace">${esc(f.text)}</div>
|
|
1169
|
+
<div class="fc-code" style="font-family:'${esc(f.family)}',monospace">const greet = (n) => \`Hello, \${n}!\`; // != === >= |> 0Oo1lI</div>
|
|
1170
|
+
<div class="fc-icons" style="font-family:'${esc(f.family)}',monospace">${iconsSample}</div>
|
|
1171
|
+
<div class="fc-actions">
|
|
1172
|
+
<button class="btn apply-ed-font" data-fam="${esc(f.family)}">Apply to Editor</button>
|
|
1173
|
+
<button class="btn btn-purple apply-tb-font" data-fam="${esc(f.family)}">Apply to Tabs</button>
|
|
1174
|
+
</div>
|
|
1175
|
+
</article>`;
|
|
1176
|
+
}).join("");
|
|
1177
|
+
|
|
1178
|
+
grid.querySelectorAll(".apply-ed-font").forEach(btn => {
|
|
1179
|
+
btn.addEventListener("click", () => updateAppearance(
|
|
1180
|
+
{ font_family: btn.dataset.fam, font_weight: document.getElementById("hdrEditorWeight").value },
|
|
1181
|
+
`Editor font → ${btn.dataset.fam}`
|
|
1182
|
+
));
|
|
1183
|
+
});
|
|
1184
|
+
grid.querySelectorAll(".apply-tb-font").forEach(btn => {
|
|
1185
|
+
btn.addEventListener("click", () => updateAppearance(
|
|
1186
|
+
{ tab_font_family: btn.dataset.fam, tab_font_weight: document.getElementById("hdrTabWeight").value },
|
|
1187
|
+
`Tab font → ${btn.dataset.fam}`
|
|
1188
|
+
));
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
async function updateAppearance(updates, label) {
|
|
1193
|
+
setStatus("Applying...");
|
|
1194
|
+
const res = await apiPost("/api/apply-appearance", { updates, label });
|
|
1195
|
+
if (res.ok) {
|
|
1196
|
+
STATE = res.state;
|
|
1197
|
+
syncHeaderAndAppearanceUI();
|
|
1198
|
+
renderFontsGrid();
|
|
1199
|
+
renderThemesGrid();
|
|
1200
|
+
setStatus("✔ " + res.msg, "ok");
|
|
1201
|
+
} else {
|
|
1202
|
+
setStatus("✖ " + res.msg, "err");
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
async function loadBackups() {
|
|
1207
|
+
const res = await apiGet("/api/backups");
|
|
1208
|
+
if (!res.ok) return;
|
|
1209
|
+
renderBackupsList(res.backups);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
function renderBackupsList(backups) {
|
|
1213
|
+
const el = document.getElementById("backupsList");
|
|
1214
|
+
if (!backups || !backups.length) {
|
|
1215
|
+
el.innerHTML = `<div style="color:var(--sub);font-size:0.84rem;padding:8px 0;">No backups saved yet.</div>`;
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
el.innerHTML = backups.map(b => `
|
|
1219
|
+
<div class="bkp-item">
|
|
1220
|
+
<div>
|
|
1221
|
+
<strong>[${String(b.index).padStart(2, "0")}] ${esc(b.theme_info)}</strong>
|
|
1222
|
+
${b.label ? `<span style="color:var(--amber);margin-left:6px;">[${esc(b.label)}]</span>` : ''}
|
|
1223
|
+
<div style="color:var(--sub);font-size:0.75rem;">${esc(b.date_str)} · ${esc(b.filename)}</div>
|
|
1224
|
+
</div>
|
|
1225
|
+
<button class="btn restore-bkp-btn" data-idx="${b.index}">↺ Restore</button>
|
|
1226
|
+
</div>
|
|
1227
|
+
`).join("");
|
|
1228
|
+
|
|
1229
|
+
el.querySelectorAll(".restore-bkp-btn").forEach(btn => {
|
|
1230
|
+
btn.addEventListener("click", async () => {
|
|
1231
|
+
const res = await apiPost("/api/restore", { target: parseInt(btn.dataset.idx, 10) });
|
|
1232
|
+
if (res.ok) {
|
|
1233
|
+
STATE = res.state;
|
|
1234
|
+
draftSymbols = STATE.symbols || null;
|
|
1235
|
+
syncHeaderAndAppearanceUI();
|
|
1236
|
+
renderThemesGrid();
|
|
1237
|
+
renderSymbolDrawer();
|
|
1238
|
+
renderBackupsList(res.backups);
|
|
1239
|
+
setStatus("✔ " + res.msg, "ok");
|
|
1240
|
+
} else {
|
|
1241
|
+
setStatus("✖ " + res.msg, "err");
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
// ── Event Wiring ──
|
|
1248
|
+
document.querySelectorAll(".nav-tab").forEach(tab => {
|
|
1249
|
+
tab.addEventListener("click", () => {
|
|
1250
|
+
document.querySelectorAll(".nav-tab").forEach(t => t.classList.remove("active"));
|
|
1251
|
+
document.querySelectorAll(".view-pane").forEach(p => p.classList.remove("active"));
|
|
1252
|
+
tab.classList.add("active");
|
|
1253
|
+
document.getElementById("view-" + tab.dataset.view).classList.add("active");
|
|
1254
|
+
if (tab.dataset.view === "backups") loadBackups();
|
|
1255
|
+
});
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
document.getElementById("initBtn").addEventListener("click", async () => {
|
|
1259
|
+
const res = await apiPost("/api/init");
|
|
1260
|
+
if (res.ok) {
|
|
1261
|
+
STATE = res.state;
|
|
1262
|
+
syncHeaderAndAppearanceUI();
|
|
1263
|
+
setStatus("✔ " + res.msg, "ok");
|
|
1264
|
+
} else {
|
|
1265
|
+
setStatus("✖ " + res.msg, "err");
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
document.getElementById("themeSearch").addEventListener("input", renderThemesGrid);
|
|
1270
|
+
document.getElementById("lenSlider").addEventListener("input", e => {
|
|
1271
|
+
document.getElementById("lenLabel").textContent = e.target.value;
|
|
1272
|
+
renderThemesGrid();
|
|
1273
|
+
renderSymbolDrawer();
|
|
1274
|
+
});
|
|
1275
|
+
document.getElementById("lenSlider").addEventListener("change", async e => {
|
|
1276
|
+
const len = parseInt(e.target.value, 10);
|
|
1277
|
+
const res = await apiPost("/api/apply-tab-theme", {
|
|
1278
|
+
theme_id: STATE.theme_id,
|
|
1279
|
+
tab_title_len: len,
|
|
1280
|
+
symbols: "keep"
|
|
1281
|
+
});
|
|
1282
|
+
if (res.ok) {
|
|
1283
|
+
STATE = res.state;
|
|
1284
|
+
setStatus(`✔ Fixed tab width set to ${len} chars`, "ok");
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
document.getElementById("toggleSymBtn").addEventListener("click", () => {
|
|
1289
|
+
document.getElementById("symDrawer").classList.toggle("open");
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
document.getElementById("resetSymBtn").addEventListener("click", () => {
|
|
1293
|
+
draftSymbols = null;
|
|
1294
|
+
renderSymbolDrawer();
|
|
1295
|
+
renderThemesGrid();
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
document.getElementById("applySymBtn").addEventListener("click", async () => {
|
|
1299
|
+
const res = await apiPost("/api/apply-tab-theme", {
|
|
1300
|
+
theme_id: STATE.theme_id,
|
|
1301
|
+
tab_title_len: STATE.tab_title_len,
|
|
1302
|
+
symbols: draftSymbols
|
|
1303
|
+
});
|
|
1304
|
+
if (res.ok) {
|
|
1305
|
+
STATE = res.state;
|
|
1306
|
+
renderThemesGrid();
|
|
1307
|
+
renderSymbolDrawer();
|
|
1308
|
+
setStatus("✔ Custom symbols applied to WezTerm!", "ok");
|
|
1309
|
+
} else {
|
|
1310
|
+
setStatus("✖ " + res.msg, "err");
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
document.getElementById("randomThemeBtn").addEventListener("click", async () => {
|
|
1315
|
+
const pick = BOOT.themes[Math.floor(Math.random() * BOOT.themes.length)];
|
|
1316
|
+
const res = await apiPost("/api/apply-tab-theme", { theme_id: pick.id, symbols: draftSymbols });
|
|
1317
|
+
if (res.ok) {
|
|
1318
|
+
STATE = res.state;
|
|
1319
|
+
syncHeaderAndAppearanceUI();
|
|
1320
|
+
renderThemesGrid();
|
|
1321
|
+
renderSymbolDrawer();
|
|
1322
|
+
setStatus(`🎲 Random theme #${pick.id} (${pick.name}) applied!`, "ok");
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
// Header font size & weight steppers
|
|
1327
|
+
function stepSize(inputId, delta, key, labelPrefix) {
|
|
1328
|
+
const el = document.getElementById(inputId);
|
|
1329
|
+
let v = Math.round(((parseFloat(el.value) || 12) + delta * 0.5) * 10) / 10;
|
|
1330
|
+
v = Math.max(6, Math.min(36, v));
|
|
1331
|
+
el.value = v;
|
|
1332
|
+
updateAppearance({ [key]: v }, `${labelPrefix} → ${v}pt`);
|
|
1333
|
+
}
|
|
1334
|
+
document.getElementById("edDec").addEventListener("click", () => stepSize("hdrEditorSize", -1, "font_size", "Editor size"));
|
|
1335
|
+
document.getElementById("edInc").addEventListener("click", () => stepSize("hdrEditorSize", +1, "font_size", "Editor size"));
|
|
1336
|
+
document.getElementById("tbDec").addEventListener("click", () => stepSize("hdrTabSize", -1, "tab_font_size", "Tab size"));
|
|
1337
|
+
document.getElementById("tbInc").addEventListener("click", () => stepSize("hdrTabSize", +1, "tab_font_size", "Tab size"));
|
|
1338
|
+
document.getElementById("hdrEditorSize").addEventListener("change", e => updateAppearance({ font_size: parseFloat(e.target.value) || 13 }, "Editor font size updated"));
|
|
1339
|
+
document.getElementById("hdrTabSize").addEventListener("change", e => updateAppearance({ tab_font_size: parseFloat(e.target.value) || 11 }, "Tab font size updated"));
|
|
1340
|
+
document.getElementById("hdrEditorWeight").addEventListener("change", e => updateAppearance({ font_weight: e.target.value }, `Editor weight → ${e.target.value}`));
|
|
1341
|
+
document.getElementById("hdrTabWeight").addEventListener("change", e => updateAppearance({ tab_font_weight: e.target.value }, `Tab weight → ${e.target.value}`));
|
|
1342
|
+
|
|
1343
|
+
// Fonts filter
|
|
1344
|
+
document.getElementById("fontSearch").addEventListener("input", renderFontsGrid);
|
|
1345
|
+
document.getElementById("filterAllFonts").addEventListener("click", () => {
|
|
1346
|
+
onlyNerd = false;
|
|
1347
|
+
document.getElementById("filterAllFonts").classList.add("active");
|
|
1348
|
+
document.getElementById("filterNerdFonts").classList.remove("active");
|
|
1349
|
+
renderFontsGrid();
|
|
1350
|
+
});
|
|
1351
|
+
document.getElementById("filterNerdFonts").addEventListener("click", () => {
|
|
1352
|
+
onlyNerd = true;
|
|
1353
|
+
document.getElementById("filterNerdFonts").classList.add("active");
|
|
1354
|
+
document.getElementById("filterAllFonts").classList.remove("active");
|
|
1355
|
+
renderFontsGrid();
|
|
1356
|
+
});
|
|
1357
|
+
document.getElementById("refreshFontsBtn").addEventListener("click", async () => {
|
|
1358
|
+
setStatus("Reloading system fonts...");
|
|
1359
|
+
const res = await apiGet("/api/fonts?refresh=1");
|
|
1360
|
+
if (res.ok) {
|
|
1361
|
+
FONTS = res.fonts;
|
|
1362
|
+
renderFontsGrid();
|
|
1363
|
+
setStatus(`✔ ${FONTS.length} fonts loaded`, "ok");
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1367
|
+
// Appearance events
|
|
1368
|
+
document.getElementById("quickSchemes").innerHTML = QUICK_SCHEMES.map(
|
|
1369
|
+
s => `<button class="scheme-chip" data-scheme="${esc(s)}">${esc(s)}</button>`
|
|
1370
|
+
).join("");
|
|
1371
|
+
document.querySelectorAll(".scheme-chip").forEach(ch => {
|
|
1372
|
+
ch.addEventListener("click", () => {
|
|
1373
|
+
document.getElementById("schemeInput").value = ch.dataset.scheme;
|
|
1374
|
+
updateAppearance({ color_scheme: ch.dataset.scheme }, `Color Scheme → ${ch.dataset.scheme}`);
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
document.getElementById("applySchemeBtn").addEventListener("click", () => {
|
|
1378
|
+
const s = document.getElementById("schemeInput").value.trim();
|
|
1379
|
+
updateAppearance({ color_scheme: s || "Default" }, `Color Scheme → ${s || "Default"}`);
|
|
1380
|
+
});
|
|
1381
|
+
document.getElementById("resetSchemeBtn").addEventListener("click", () => {
|
|
1382
|
+
document.getElementById("schemeInput").value = "";
|
|
1383
|
+
updateAppearance({ color_scheme: "Default" }, "Color Scheme → Default");
|
|
1384
|
+
});
|
|
1385
|
+
|
|
1386
|
+
document.getElementById("opacityRange").addEventListener("input", e => {
|
|
1387
|
+
document.getElementById("opacityVal").textContent = Number(e.target.value).toFixed(2);
|
|
1388
|
+
});
|
|
1389
|
+
document.getElementById("opacityRange").addEventListener("change", e => {
|
|
1390
|
+
updateAppearance({ window_opacity: parseFloat(e.target.value) }, `Opacity → ${Number(e.target.value).toFixed(2)}`);
|
|
1391
|
+
});
|
|
1392
|
+
document.getElementById("paddingInput").addEventListener("change", e => {
|
|
1393
|
+
updateAppearance({ window_padding: parseInt(e.target.value, 10) || 0 }, `Padding → ${e.target.value}px`);
|
|
1394
|
+
});
|
|
1395
|
+
document.getElementById("decorationsSelect").addEventListener("change", e => {
|
|
1396
|
+
updateAppearance({ window_decorations: e.target.value }, `Decorations → ${e.target.value}`);
|
|
1397
|
+
});
|
|
1398
|
+
document.getElementById("lineHeightInput").addEventListener("change", e => {
|
|
1399
|
+
updateAppearance({ line_height: parseFloat(e.target.value) || 1.0 }, `Line Height → ${e.target.value}`);
|
|
1400
|
+
});
|
|
1401
|
+
document.getElementById("cursorStyleSelect").addEventListener("change", e => {
|
|
1402
|
+
updateAppearance({ cursor_style: e.target.value }, `Cursor → ${e.target.value}`);
|
|
1403
|
+
});
|
|
1404
|
+
document.getElementById("cursorBlinkInput").addEventListener("change", e => {
|
|
1405
|
+
updateAppearance({ cursor_blink_rate: parseInt(e.target.value, 10) || 0 }, `Blink Rate → ${e.target.value}ms`);
|
|
1406
|
+
});
|
|
1407
|
+
document.getElementById("scrollbackInput").addEventListener("change", e => {
|
|
1408
|
+
updateAppearance({ scrollback_lines: parseInt(e.target.value, 10) || 5000 }, `Scrollback → ${e.target.value}`);
|
|
1409
|
+
});
|
|
1410
|
+
document.getElementById("tabBottomCheck").addEventListener("change", e => {
|
|
1411
|
+
updateAppearance({ tab_bar_at_bottom: e.target.checked }, `Tab bar at bottom → ${e.target.checked ? "Yes" : "No"}`);
|
|
1412
|
+
});
|
|
1413
|
+
document.getElementById("hideOneTabCheck").addEventListener("change", e => {
|
|
1414
|
+
updateAppearance({ hide_tab_bar_if_only_one_tab: e.target.checked }, `Hide single tab → ${e.target.checked ? "Yes" : "No"}`);
|
|
1415
|
+
});
|
|
1416
|
+
document.getElementById("bellCheck").addEventListener("change", e => {
|
|
1417
|
+
updateAppearance({ audible_bell: e.target.checked ? "SystemBeep" : "Disabled" }, "Audible bell updated");
|
|
1418
|
+
});
|
|
1419
|
+
|
|
1420
|
+
// Backups & Presets
|
|
1421
|
+
document.getElementById("createBackupBtn").addEventListener("click", async () => {
|
|
1422
|
+
const label = document.getElementById("backupLabelInput").value.trim();
|
|
1423
|
+
const res = await apiPost("/api/backup", { label });
|
|
1424
|
+
if (res.ok) {
|
|
1425
|
+
document.getElementById("backupLabelInput").value = "";
|
|
1426
|
+
renderBackupsList(res.backups);
|
|
1427
|
+
setStatus("✔ " + res.msg, "ok");
|
|
1428
|
+
} else {
|
|
1429
|
+
setStatus("✖ " + res.msg, "err");
|
|
1430
|
+
}
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
document.getElementById("loadExportBtn").addEventListener("click", async () => {
|
|
1434
|
+
const res = await apiGet("/api/export");
|
|
1435
|
+
if (res.ok) {
|
|
1436
|
+
document.getElementById("presetTextarea").value = JSON.stringify(res.preset, null, 2);
|
|
1437
|
+
setStatus("✔ Current preset loaded", "ok");
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
document.getElementById("downloadPresetBtn").addEventListener("click", async () => {
|
|
1442
|
+
const res = await apiGet("/api/export");
|
|
1443
|
+
if (!res.ok) return;
|
|
1444
|
+
const blob = new Blob([JSON.stringify(res.preset, null, 2)], { type: "application/json" });
|
|
1445
|
+
const a = document.createElement("a");
|
|
1446
|
+
a.href = URL.createObjectURL(blob);
|
|
1447
|
+
a.download = `wezterm-preset-theme-${res.preset.theme_id}.json`;
|
|
1448
|
+
a.click();
|
|
1449
|
+
});
|
|
1450
|
+
|
|
1451
|
+
document.getElementById("importPresetBtn").addEventListener("click", async () => {
|
|
1452
|
+
const raw = document.getElementById("presetTextarea").value.trim();
|
|
1453
|
+
if (!raw) return;
|
|
1454
|
+
const res = await apiPost("/api/import", { preset: raw });
|
|
1455
|
+
if (res.ok) {
|
|
1456
|
+
STATE = res.state;
|
|
1457
|
+
draftSymbols = STATE.symbols || null;
|
|
1458
|
+
syncHeaderAndAppearanceUI();
|
|
1459
|
+
renderThemesGrid();
|
|
1460
|
+
renderSymbolDrawer();
|
|
1461
|
+
setStatus("✔ " + res.msg, "ok");
|
|
1462
|
+
} else {
|
|
1463
|
+
setStatus("✖ " + res.msg, "err");
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
async function boot() {
|
|
1468
|
+
setStatus("Initializing studio...");
|
|
1469
|
+
BOOT = await apiGet("/api/bootstrap");
|
|
1470
|
+
STATE = BOOT.state;
|
|
1471
|
+
draftSymbols = STATE.symbols || null;
|
|
1472
|
+
|
|
1473
|
+
// Build category pills
|
|
1474
|
+
const catEl = document.getElementById("catPills");
|
|
1475
|
+
catEl.innerHTML = `<button class="pill-btn active" data-cat="">All (${BOOT.themes.length})</button>` +
|
|
1476
|
+
BOOT.categories.map(c => `<button class="pill-btn" data-cat="${esc(c.name)}">${esc(c.name)} (${String(c.lo).padStart(2,"0")}-${String(c.hi).padStart(2,"0")})</button>`).join("");
|
|
1477
|
+
catEl.querySelectorAll(".pill-btn").forEach(btn => {
|
|
1478
|
+
btn.addEventListener("click", () => {
|
|
1479
|
+
catEl.querySelectorAll(".pill-btn").forEach(b => b.classList.remove("active"));
|
|
1480
|
+
btn.classList.add("active");
|
|
1481
|
+
curCat = btn.dataset.cat;
|
|
1482
|
+
renderThemesGrid();
|
|
1483
|
+
});
|
|
1484
|
+
});
|
|
1485
|
+
|
|
1486
|
+
syncHeaderAndAppearanceUI();
|
|
1487
|
+
renderThemesGrid();
|
|
1488
|
+
renderSymbolDrawer();
|
|
1489
|
+
setStatus("Ready", "ok");
|
|
1490
|
+
|
|
1491
|
+
// Load fonts & schemes asynchronously
|
|
1492
|
+
apiGet("/api/fonts").then(res => {
|
|
1493
|
+
if (res.ok) {
|
|
1494
|
+
FONTS = res.fonts;
|
|
1495
|
+
renderFontsGrid();
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
apiGet("/api/schemes").then(res => {
|
|
1499
|
+
if (res.ok) {
|
|
1500
|
+
document.getElementById("schemesDatalist").innerHTML = res.schemes.map(s => `<option value="${esc(s)}"></option>`).join("");
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
boot();
|
|
1506
|
+
</script>
|
|
1507
|
+
</body>
|
|
1508
|
+
</html>
|