-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview.html
More file actions
870 lines (803 loc) · 44.5 KB
/
preview.html
File metadata and controls
870 lines (803 loc) · 44.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Drift Theme Family — Palette Preview</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Inter', system-ui, -apple-system, sans-serif;
background: #111;
color: #ccc;
padding: 2rem;
line-height: 1.5;
}
h1 { font-size: 1.75rem; font-weight: 700; color: #fff; margin-bottom: 0.25rem; }
h2 { font-size: 1.25rem; font-weight: 600; color: #fff; margin-bottom: 1rem; }
h3 { font-size: 0.9rem; font-weight: 600; color: #999; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.subtitle { color: #777; font-size: 0.95rem; margin-bottom: 2rem; }
/* Navigation */
.nav { display: flex; gap: 0.5rem; margin-bottom: 2rem; flex-wrap: wrap; }
.nav button {
padding: 0.5rem 1.25rem; border: 1px solid #333; border-radius: 6px;
background: #1a1a1a; color: #ccc; font-size: 0.875rem; cursor: pointer;
transition: all 0.15s;
}
.nav button:hover { border-color: #555; color: #fff; }
.nav button.active { background: #2a2a2a; border-color: #666; color: #fff; }
/* View modes */
.view-toggle { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.view-toggle button {
padding: 0.4rem 1rem; border: 1px solid #333; border-radius: 6px;
background: #1a1a1a; color: #888; font-size: 0.8rem; cursor: pointer;
}
.view-toggle button.active { background: #222; border-color: #555; color: #fff; }
/* Theme panel */
.theme-panel { display: none; }
.theme-panel.active { display: block; }
.compare-view { display: none; gap: 2rem; }
.compare-view.active { display: grid; grid-template-columns: 1fr 1fr; }
.compare-view .compare-col { min-width: 0; }
/* Section layout */
.section { margin-bottom: 2.5rem; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; }
/* Color swatch */
.swatch {
border-radius: 8px; overflow: hidden; border: 1px solid #2a2a2a;
transition: transform 0.1s;
}
.swatch:hover { transform: scale(1.02); }
.swatch-color { height: 56px; position: relative; }
.swatch-color .hex {
position: absolute; bottom: 4px; right: 6px;
font-size: 0.65rem; font-family: 'JetBrains Mono', 'Fira Code', monospace;
opacity: 0.8; text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.swatch-label {
padding: 0.35rem 0.5rem; font-size: 0.7rem; color: #999;
background: #1a1a1a; font-family: 'JetBrains Mono', monospace;
}
/* Background hierarchy (horizontal bar) */
.bg-hierarchy {
display: flex; border-radius: 8px; overflow: hidden;
border: 1px solid #2a2a2a; margin-bottom: 1rem;
}
.bg-step {
flex: 1; padding: 1.25rem 0.75rem; text-align: center;
font-size: 0.7rem; font-family: 'JetBrains Mono', monospace;
}
.bg-step .step-label { font-weight: 600; margin-bottom: 0.25rem; }
.bg-step .step-hex { opacity: 0.7; font-size: 0.65rem; }
/* Foreground samples */
.fg-samples { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fg-sample {
padding: 1rem 1.5rem; border-radius: 8px; font-size: 0.9rem;
border: 1px solid #2a2a2a; min-width: 200px;
}
.fg-sample .fg-label { font-size: 0.7rem; opacity: 0.6; font-family: monospace; margin-bottom: 0.25rem; }
/* Code preview */
.code-preview {
border-radius: 10px; overflow: hidden; border: 1px solid #2a2a2a;
font-family: 'Victor Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
font-size: 0.825rem; line-height: 1.7;
}
.code-titlebar {
padding: 0.5rem 1rem; font-size: 0.7rem; display: flex; align-items: center; gap: 0.5rem;
border-bottom: 1px solid transparent;
}
.code-titlebar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.code-body { padding: 1rem 1.25rem; overflow-x: auto; }
.code-body .line { white-space: pre; }
.code-body .line-num {
display: inline-block; width: 2.5em; text-align: right; margin-right: 1.5em;
user-select: none;
}
.italic { font-style: italic; }
.bold { font-weight: 700; }
/* Editor mockup */
.editor-mockup {
display: grid; grid-template-columns: 48px 220px 1fr;
border-radius: 10px; overflow: hidden; border: 1px solid #2a2a2a;
height: 420px;
}
.editor-activity {
display: flex; flex-direction: column; align-items: center;
padding: 0.75rem 0; gap: 1rem;
}
.editor-activity .icon {
width: 24px; height: 24px; border-radius: 4px; opacity: 0.5;
}
.editor-activity .icon.active { opacity: 1; }
.editor-sidebar {
padding: 0.75rem 0; font-size: 0.75rem; overflow: hidden;
border-right: 1px solid transparent;
}
.sidebar-header {
padding: 0 0.75rem 0.5rem; font-size: 0.65rem; font-weight: 600;
text-transform: uppercase; letter-spacing: 0.05em;
}
.sidebar-item {
padding: 0.2rem 0.75rem 0.2rem 1.25rem; cursor: default;
font-family: system-ui, sans-serif; font-size: 0.75rem;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-item.active { font-weight: 500; }
.editor-main { display: flex; flex-direction: column; }
.editor-tabs {
display: flex; font-size: 0.75rem; border-bottom: 1px solid transparent;
}
.editor-tab {
padding: 0.5rem 1rem; border-right: 1px solid transparent;
font-family: system-ui; white-space: nowrap;
}
.editor-tab.active { border-bottom: 2px solid transparent; }
.editor-code { flex: 1; padding: 0.75rem 1rem; overflow: auto; font-size: 0.8rem; line-height: 1.65; }
.editor-statusbar {
padding: 0.25rem 0.75rem; font-size: 0.65rem; display: flex; justify-content: space-between;
}
/* Terminal preview */
.terminal-preview {
border-radius: 10px; overflow: hidden; border: 1px solid #2a2a2a;
font-family: 'Victor Mono', 'JetBrains Mono', monospace; font-size: 0.8rem;
line-height: 1.6;
}
.terminal-titlebar { padding: 0.4rem 0.75rem; font-size: 0.65rem; display: flex; gap: 0.4rem; align-items: center; }
.terminal-body { padding: 0.75rem 1rem; }
.terminal-body .prompt { margin-bottom: 0.1rem; }
/* ANSI grid */
.ansi-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.35rem; }
.ansi-cell {
height: 36px; border-radius: 5px; display: flex; align-items: center;
justify-content: center; font-size: 0.55rem; font-family: monospace;
border: 1px solid rgba(255,255,255,0.05);
}
@media (max-width: 900px) {
.compare-view.active { grid-template-columns: 1fr; }
.editor-mockup { grid-template-columns: 40px 180px 1fr; height: 360px; }
}
</style>
</head>
<body>
<h1>Drift Theme Family</h1>
<p class="subtitle">Palette preview for VS Code dual-font themes — 4 dark + 4 light variants with cursive italic support</p>
<div class="view-toggle" id="viewToggle">
<button class="active" data-mode="single">Single Theme</button>
<button data-mode="compare">Compare Side-by-Side</button>
</div>
<div class="nav" id="themeNav"></div>
<!-- Single theme view -->
<div id="singleView">
<div class="theme-panel active" id="panel-0"></div>
</div>
<!-- Compare view -->
<div class="compare-view" id="compareView">
<div class="compare-col" id="compare-left"></div>
<div class="compare-col" id="compare-right"></div>
</div>
<script>
// ── Palette Data ──────────────────────────────────────────────────────────────
// To add a new palette: copy one of the objects below, change the values, and
// it will automatically appear as a tab.
const palettes = [
{
"name": "Drift Ocean",
"type": "dark",
"bg": { "primary": "#0b131f", "secondary": "#0e1724", "tertiary": "#152238", "active": "#1d3048", "highlight": "#263a56" },
"fg": { "primary": "#c8d6e5", "secondary": "#9eafc4", "muted": "#5c7392" },
"accent": { "primary": "#3d8fd1", "selection": "#1c3854", "selectionInactive": "#152a44" },
"border": "#1b2e48",
"syntax": { "comment": "#4a6a8a", "keyword": "#6eaaf2", "string": "#89c4a7", "number": "#d4a96a", "variable": "#9ec8f0", "function": "#e8c87a", "class": "#5ec4b6", "operator": "#8899aa", "punctuation": "#6a7d94", "import": "#c792ea", "constant": "#f78c6c", "tag": "#7eb8da", "attribute": "#c5a5e8", "property": "#9ec8f0", "type": "#5ec4b6", "regexp": "#89ddff", "deleted": "#ff6b6b", "inserted": "#addb67" },
"ui": { "cursor": "#5aafff", "statusBar": "#0e1724", "statusBarFg": "#8899aa", "activityBar": "#0b131f", "activityBarFg": "#5c7392", "activityBarActive": "#3d8fd1", "badge": "#3d8fd1", "badgeFg": "#ffffff", "button": "#3d8fd1", "buttonFg": "#ffffff", "input": "#0e1724", "inputBorder": "#1b2e48", "listActive": "#1c3854", "listHover": "#152238", "tab": "#0b131f", "tabActive": "#152238", "tabBorder": "#1b2e48" },
"terminal": { "black": "#0b131f", "red": "#ff6b6b", "green": "#addb67", "yellow": "#e8c87a", "blue": "#6eaaf2", "magenta": "#c792ea", "cyan": "#89ddff", "white": "#c8d6e5", "brightBlack": "#5c7392", "brightRed": "#ff8a8a", "brightGreen": "#c5e99b", "brightYellow": "#ffd580", "brightBlue": "#9ec8f0", "brightMagenta": "#ddb3f0", "brightCyan": "#a8ecff", "brightWhite": "#e8f0f8" }
},
{
"name": "Drift Midnight",
"type": "dark",
"bg": { "primary": "#0f111a", "secondary": "#141621", "tertiary": "#1a1c2e", "active": "#222438", "highlight": "#2a2d42" },
"fg": { "primary": "#bfc7d5", "secondary": "#a6acb9", "muted": "#676e95" },
"accent": { "primary": "#82aaff", "selection": "#1f2d4d", "selectionInactive": "#1a2540" },
"border": "#1b1e2e",
"syntax": { "comment": "#676e95", "keyword": "#c792ea", "string": "#b8d8a0", "number": "#e0a080", "variable": "#bfc7d5", "function": "#82aaff", "class": "#e8c888", "operator": "#89ddff", "punctuation": "#676e95", "import": "#c792ea", "constant": "#f78c6c", "tag": "#f07178", "attribute": "#e8c888", "property": "#bfc7d5", "type": "#e8c888", "regexp": "#89ddff", "deleted": "#f07178", "inserted": "#b8d8a0" },
"ui": { "cursor": "#ffcc00", "statusBar": "#0f111a", "statusBarFg": "#676e95", "activityBar": "#0f111a", "activityBarFg": "#676e95", "activityBarActive": "#82aaff", "badge": "#82aaff", "badgeFg": "#000000", "button": "#82aaff", "buttonFg": "#000000", "input": "#141621", "inputBorder": "#1b1e2e", "listActive": "#1f2d4d", "listHover": "#1a1c2e", "tab": "#0f111a", "tabActive": "#1a1c2e", "tabBorder": "#1b1e2e" },
"terminal": { "black": "#0f111a", "red": "#f07178", "green": "#b8d8a0", "yellow": "#e8c888", "blue": "#82aaff", "magenta": "#c792ea", "cyan": "#89ddff", "white": "#bfc7d5", "brightBlack": "#676e95", "brightRed": "#f07178", "brightGreen": "#c8e8b8", "brightYellow": "#f0d8a0", "brightBlue": "#82aaff", "brightMagenta": "#c792ea", "brightCyan": "#89ddff", "brightWhite": "#ffffff" }
},
{
"name": "Drift Dusk",
"type": "dark",
"bg": { "primary": "#17181a", "secondary": "#1c1d20", "tertiary": "#222328", "active": "#2a2b32", "highlight": "#33343c" },
"fg": { "primary": "#d0d2d8", "secondary": "#a8aab2", "muted": "#686a75" },
"accent": { "primary": "#8aabcc", "selection": "#2a3545", "selectionInactive": "#232a38" },
"border": "#2a2c32",
"syntax": { "comment": "#6a6c7a", "keyword": "#b0a0d8", "string": "#a8d4a0", "number": "#ddb888", "variable": "#c0c4cc", "function": "#e0c898", "class": "#90d0c0", "operator": "#8890a0", "punctuation": "#5a5e6a", "import": "#c8a8e0", "constant": "#e0a888", "tag": "#a0c8e0", "attribute": "#c8b0e0", "property": "#b8c8d8", "type": "#90d0c0", "regexp": "#a0d8e8", "deleted": "#e8a0a0", "inserted": "#a8d8a0" },
"ui": { "cursor": "#a8c8e0", "statusBar": "#1c1d20", "statusBarFg": "#686a75", "activityBar": "#17181a", "activityBarFg": "#686a75", "activityBarActive": "#8aabcc", "badge": "#8aabcc", "badgeFg": "#000000", "button": "#8aabcc", "buttonFg": "#000000", "input": "#1c1d20", "inputBorder": "#2a2c32", "listActive": "#2a3545", "listHover": "#222328", "tab": "#17181a", "tabActive": "#222328", "tabBorder": "#2a2c32" },
"terminal": { "black": "#17181a", "red": "#e8a0a0", "green": "#a8d8a0", "yellow": "#e0c898", "blue": "#a0b8e0", "magenta": "#c8a8e0", "cyan": "#a0d8e8", "white": "#d0d2d8", "brightBlack": "#686a75", "brightRed": "#f0b0b0", "brightGreen": "#b8e8b8", "brightYellow": "#f0d8a8", "brightBlue": "#b0c8f0", "brightMagenta": "#d8b8f0", "brightCyan": "#b0e8f0", "brightWhite": "#e8eaee" }
},
{
"name": "Drift Forest",
"type": "dark",
"bg": { "primary": "#0d1a14", "secondary": "#111f18", "tertiary": "#18281f", "active": "#213428", "highlight": "#2c4034" },
"fg": { "primary": "#c4d8ce", "secondary": "#9ab5a5", "muted": "#5e7d6a" },
"accent": { "primary": "#4aab7a", "selection": "#1c3828", "selectionInactive": "#152a20" },
"border": "#1e3528",
"syntax": { "comment": "#5a8a72", "keyword": "#82c4e0", "string": "#a8d4a0", "number": "#e0a070", "variable": "#b8d0c4", "function": "#d4b87a", "class": "#6ecaa0", "operator": "#7a9a8a", "punctuation": "#5a7868", "import": "#d0a0e0", "constant": "#e0a070", "tag": "#82c4e0", "attribute": "#c0a8d8", "property": "#b8d0c4", "type": "#6ecaa0", "regexp": "#88d8e8", "deleted": "#e8a0a0", "inserted": "#a0d8a0" },
"ui": { "cursor": "#4adb8a", "statusBar": "#111f18", "statusBarFg": "#5e7d6a", "activityBar": "#0d1a14", "activityBarFg": "#5e7d6a", "activityBarActive": "#4aab7a", "badge": "#4aab7a", "badgeFg": "#000000", "button": "#4aab7a", "buttonFg": "#000000", "input": "#111f18", "inputBorder": "#1e3528", "listActive": "#1c3828", "listHover": "#18281f", "tab": "#0d1a14", "tabActive": "#18281f", "tabBorder": "#1e3528" },
"terminal": { "black": "#0d1a14", "red": "#e8a0a0", "green": "#a0d8a0", "yellow": "#d4b87a", "blue": "#82c4e0", "magenta": "#d0a0e0", "cyan": "#88d8e8", "white": "#c4d8ce", "brightBlack": "#5e7d6a", "brightRed": "#f0b0b0", "brightGreen": "#b8e8b8", "brightYellow": "#e0c890", "brightBlue": "#98d4f0", "brightMagenta": "#e0b8f0", "brightCyan": "#a0e8f0", "brightWhite": "#e0f0e8" }
},
{
"name": "Drift Shore",
"type": "light",
"bg": { "primary": "#f5f8fb", "secondary": "#edf2f7", "tertiary": "#e2eaf2", "active": "#d6e4f0", "highlight": "#c8d8ea" },
"fg": { "primary": "#1a2a3a", "secondary": "#3a5068", "muted": "#607590" },
"accent": { "primary": "#2b7cc4", "selection": "#c8ddf0", "selectionInactive": "#dbe8f4" },
"border": "#d0dce8",
"syntax": { "comment": "#5a7590", "keyword": "#2968b0", "string": "#2a7a5e", "number": "#906018", "variable": "#1a2a3a", "function": "#8a6a10", "class": "#1a7a6a", "operator": "#5a6a7a", "punctuation": "#7a8a9a", "import": "#7a40a8", "constant": "#c05a30", "tag": "#2a70a0", "attribute": "#7a50b0", "property": "#3060a0", "type": "#1a7a6a", "regexp": "#1878a8", "deleted": "#d03030", "inserted": "#2a7a40" },
"ui": { "cursor": "#2b7cc4", "statusBar": "#edf2f7", "statusBarFg": "#6a7b90", "activityBar": "#f5f8fb", "activityBarFg": "#6a7b90", "activityBarActive": "#2b7cc4", "badge": "#2b7cc4", "badgeFg": "#ffffff", "button": "#2b7cc4", "buttonFg": "#ffffff", "input": "#ffffff", "inputBorder": "#d0dce8", "listActive": "#d6e4f0", "listHover": "#e2eaf2", "tab": "#edf2f7", "tabActive": "#f5f8fb", "tabBorder": "#d0dce8" },
"terminal": { "black": "#1a2a3a", "red": "#c83030", "green": "#2a7a40", "yellow": "#906a10", "blue": "#2968b0", "magenta": "#7a40a8", "cyan": "#1878a8", "white": "#f5f8fb", "brightBlack": "#5a6a7a", "brightRed": "#e04040", "brightGreen": "#388a50", "brightYellow": "#a88020", "brightBlue": "#3878c0", "brightMagenta": "#8a50b8", "brightCyan": "#2088b8", "brightWhite": "#ffffff" }
},
{
"name": "Drift Morning",
"type": "light",
"bg": { "primary": "#f8f8fc", "secondary": "#f0f0f6", "tertiary": "#e6e8f0", "active": "#dcdee8", "highlight": "#d0d4e2" },
"fg": { "primary": "#1a1c2e", "secondary": "#3a3e58", "muted": "#6a6e88" },
"accent": { "primary": "#6080e0", "selection": "#d8ddf4", "selectionInactive": "#e4e6f2" },
"border": "#d4d6e2",
"syntax": { "comment": "#6a6e8a", "keyword": "#9d3fcf", "string": "#4a8018", "number": "#a84820", "variable": "#1a1c2e", "function": "#2858c0", "class": "#8a6a10", "operator": "#2890c8", "punctuation": "#8a8ea0", "import": "#9d3fcf", "constant": "#d06028", "tag": "#d04050", "attribute": "#8a6a10", "property": "#1a1c2e", "type": "#8a6a10", "regexp": "#2890c8", "deleted": "#d04050", "inserted": "#4a8018" },
"ui": { "cursor": "#d0a020", "statusBar": "#f0f0f6", "statusBarFg": "#6a6e88", "activityBar": "#f8f8fc", "activityBarFg": "#8a8ea8", "activityBarActive": "#6080e0", "badge": "#6080e0", "badgeFg": "#ffffff", "button": "#6080e0", "buttonFg": "#ffffff", "input": "#ffffff", "inputBorder": "#d4d6e2", "listActive": "#dcdee8", "listHover": "#e6e8f0", "tab": "#f0f0f6", "tabActive": "#f8f8fc", "tabBorder": "#d4d6e2" },
"terminal": { "black": "#1a1c2e", "red": "#c04050", "green": "#3a7018", "yellow": "#8a6a10", "blue": "#2858c0", "magenta": "#8a40c0", "cyan": "#2878a8", "white": "#f8f8fc", "brightBlack": "#5a5e78", "brightRed": "#d05060", "brightGreen": "#4a8828", "brightYellow": "#9a7a20", "brightBlue": "#3868d0", "brightMagenta": "#9a50d0", "brightCyan": "#3888b8", "brightWhite": "#ffffff" }
},
{
"name": "Drift Dawn",
"type": "light",
"bg": { "primary": "#ede5dd", "secondary": "#e5dcd2", "tertiary": "#dcd2c6", "active": "#d0c4b6", "highlight": "#c2b5a3" },
"fg": { "primary": "#2a231c", "secondary": "#55483a", "muted": "#7a6a58" },
"accent": { "primary": "#8a5a40", "selection": "#d8c8b4", "selectionInactive": "#dfd2c0" },
"border": "#d0c4b2",
"syntax": { "comment": "#706050", "keyword": "#8a4878", "string": "#4a6a2a", "number": "#8a5020", "variable": "#2a231c", "function": "#8a5a20", "class": "#2a6868", "operator": "#6a5a48", "punctuation": "#9a8a78", "import": "#8a4878", "constant": "#a05028", "tag": "#4a6888", "attribute": "#7a4878", "property": "#3a3020", "type": "#2a6868", "regexp": "#3878a0", "deleted": "#b03030", "inserted": "#4a7a28" },
"ui": { "cursor": "#8a5a40", "statusBar": "#e5dcd2", "statusBarFg": "#7a6a58", "activityBar": "#ede5dd", "activityBarFg": "#7a6a58", "activityBarActive": "#8a5a40", "badge": "#8a5a40", "badgeFg": "#ffffff", "button": "#8a5a40", "buttonFg": "#ffffff", "input": "#f5efe7", "inputBorder": "#d0c4b2", "listActive": "#d0c4b6", "listHover": "#dcd2c6", "tab": "#e5dcd2", "tabActive": "#ede5dd", "tabBorder": "#d0c4b2" },
"terminal": { "black": "#2a231c", "red": "#b03030", "green": "#4a7a28", "yellow": "#8a5a20", "blue": "#4a6888", "magenta": "#8a4878", "cyan": "#3878a0", "white": "#ede5dd", "brightBlack": "#6a5a48", "brightRed": "#c04040", "brightGreen": "#5a8a38", "brightYellow": "#9a6a28", "brightBlue": "#5a7898", "brightMagenta": "#9a5888", "brightCyan": "#4888b0", "brightWhite": "#ffffff" }
},
{
"name": "Drift Sage",
"type": "light",
"bg": { "primary": "#f2f7f4", "secondary": "#e8f0ec", "tertiary": "#dce8e2", "active": "#cfddd6", "highlight": "#c2d2c8" },
"fg": { "primary": "#1a2a22", "secondary": "#3a5548", "muted": "#5a7868" },
"accent": { "primary": "#2a8a5a", "selection": "#c8e0d4", "selectionInactive": "#d8eae0" },
"border": "#c4d6cc",
"syntax": { "comment": "#507060", "keyword": "#2060a0", "string": "#28703e", "number": "#955820", "variable": "#1a2a22", "function": "#7a5a08", "class": "#187050", "operator": "#4a6858", "punctuation": "#7a9a8a", "import": "#7a3890", "constant": "#955820", "tag": "#2060a0", "attribute": "#6a3888", "property": "#305040", "type": "#187050", "regexp": "#1870a0", "deleted": "#c03030", "inserted": "#287038" },
"ui": { "cursor": "#2a8a5a", "statusBar": "#e8f0ec", "statusBarFg": "#5a7868", "activityBar": "#f2f7f4", "activityBarFg": "#5a7868", "activityBarActive": "#2a8a5a", "badge": "#2a8a5a", "badgeFg": "#ffffff", "button": "#2a8a5a", "buttonFg": "#ffffff", "input": "#ffffff", "inputBorder": "#c4d6cc", "listActive": "#cfddd6", "listHover": "#dce8e2", "tab": "#e8f0ec", "tabActive": "#f2f7f4", "tabBorder": "#c4d6cc" },
"terminal": { "black": "#1a2a22", "red": "#c03030", "green": "#287038", "yellow": "#7a5a08", "blue": "#2060a0", "magenta": "#7a3890", "cyan": "#1870a0", "white": "#f2f7f4", "brightBlack": "#5a7868", "brightRed": "#d04040", "brightGreen": "#388848", "brightYellow": "#8a6a18", "brightBlue": "#3070b0", "brightMagenta": "#8a48a0", "brightCyan": "#2880b0", "brightWhite": "#ffffff" }
}
];
// ── Utility Functions ─────────────────────────────────────────────────────────
function hexToRgb(hex) {
const r = parseInt(hex.slice(1,3),16)/255;
const g = parseInt(hex.slice(3,5),16)/255;
const b = parseInt(hex.slice(5,7),16)/255;
return [r,g,b];
}
function luminance(hex) {
const [r,g,b] = hexToRgb(hex).map(function(c) {
return c <= 0.03928 ? c/12.92 : Math.pow((c+0.055)/1.055, 2.4);
});
return 0.2126*r + 0.7152*g + 0.0722*b;
}
function contrastRatio(c1, c2) {
var l1 = luminance(c1), l2 = luminance(c2);
var lighter = Math.max(l1,l2), darker = Math.min(l1,l2);
return ((lighter + 0.05) / (darker + 0.05)).toFixed(2);
}
function textColorOn(bg) {
return luminance(bg) > 0.18 ? '#000000' : '#ffffff';
}
function esc(str) {
var div = document.createElement('div');
div.appendChild(document.createTextNode(str));
return div.textContent;
}
// ── Code Sample Builder ───────────────────────────────────────────────────────
function buildCodeSample(p) {
var s = p.syntax;
var lines = [];
function span(color, text, isItalic) {
var el = document.createElement('span');
el.style.color = color;
if (isItalic) el.style.fontStyle = 'italic';
el.textContent = text;
return el.outerHTML;
}
lines.push(span(s.comment, '// Authentication middleware', true));
lines.push(span(s.import, 'import', true) + ' ' + span(s.punctuation, '{') + ' ' + span(s.variable, 'Request') + span(s.punctuation, ',') + ' ' + span(s.variable, 'Response') + ' ' + span(s.punctuation, '}') + ' ' + span(s.import, 'from', true) + ' ' + span(s.string, "'express'"));
lines.push(span(s.import, 'import', true) + ' ' + span(s.punctuation, '{') + ' ' + span(s.variable, 'verify') + ' ' + span(s.punctuation, '}') + ' ' + span(s.import, 'from', true) + ' ' + span(s.string, "'jsonwebtoken'"));
lines.push('');
lines.push(span(s.keyword, 'interface', true) + ' ' + span(s.type, 'AuthConfig', true) + ' ' + span(s.punctuation, '{'));
lines.push(' ' + span(s.property, 'secret') + span(s.operator, ':') + ' ' + span(s.type, 'string', true));
lines.push(' ' + span(s.property, 'expiresIn') + span(s.operator, ':') + ' ' + span(s.number, 'number'));
lines.push(' ' + span(s.property, 'issuer') + span(s.punctuation, '?') + span(s.operator, ':') + ' ' + span(s.type, 'string', true));
lines.push(span(s.punctuation, '}'));
lines.push('');
lines.push(span(s.keyword, 'const', true) + ' ' + span(s.constant, 'MAX_RETRIES') + ' ' + span(s.operator, '=') + ' ' + span(s.number, '3'));
lines.push(span(s.keyword, 'const', true) + ' ' + span(s.constant, 'TOKEN_PREFIX') + ' ' + span(s.operator, '=') + ' ' + span(s.string, '"Bearer "'));
lines.push('');
lines.push(span(s.comment, '/** Validate JWT and attach user to request */', true));
lines.push(span(s.keyword, 'export', true) + ' ' + span(s.keyword, 'async', true) + ' ' + span(s.keyword, 'function', true) + ' ' + span(s.function, 'authenticate', true) + span(s.punctuation, '('));
lines.push(' ' + span(s.variable, 'req', true) + span(s.operator, ':') + ' ' + span(s.class, 'Request') + span(s.punctuation, ','));
lines.push(' ' + span(s.variable, 'config', true) + span(s.operator, ':') + ' ' + span(s.type, 'AuthConfig', true));
lines.push(span(s.punctuation, ')') + span(s.operator, ':') + ' ' + span(s.class, 'Promise') + span(s.operator, '<') + span(s.type, 'boolean', true) + span(s.operator, '>') + ' ' + span(s.punctuation, '{'));
lines.push(' ' + span(s.keyword, 'const', true) + ' ' + span(s.variable, 'header') + ' ' + span(s.operator, '=') + ' ' + span(s.variable, 'req', true) + span(s.punctuation, '.') + span(s.property, 'headers') + span(s.punctuation, '[') + span(s.string, "'authorization'") + span(s.punctuation, ']'));
lines.push('');
lines.push(' ' + span(s.keyword, 'if', true) + ' ' + span(s.punctuation, '(') + span(s.operator, '!') + span(s.variable, 'header') + ' ' + span(s.operator, '||') + ' ' + span(s.operator, '!') + span(s.variable, 'header') + span(s.punctuation, '.') + span(s.function, 'startsWith') + span(s.punctuation, '(') + span(s.constant, 'TOKEN_PREFIX') + span(s.punctuation, '))') + ' ' + span(s.punctuation, '{'));
lines.push(' ' + span(s.keyword, 'return', true) + ' ' + span(s.constant, 'false'));
lines.push(' ' + span(s.punctuation, '}'));
lines.push('');
lines.push(' ' + span(s.keyword, 'try', true) + ' ' + span(s.punctuation, '{'));
lines.push(' ' + span(s.keyword, 'const', true) + ' ' + span(s.variable, 'token') + ' ' + span(s.operator, '=') + ' ' + span(s.variable, 'header') + span(s.punctuation, '.') + span(s.function, 'slice') + span(s.punctuation, '(') + span(s.constant, 'TOKEN_PREFIX') + span(s.punctuation, '.') + span(s.property, 'length') + span(s.punctuation, ')'));
lines.push(' ' + span(s.keyword, 'const', true) + ' ' + span(s.variable, 'payload') + ' ' + span(s.operator, '=') + ' ' + span(s.keyword, 'await', true) + ' ' + span(s.function, 'verify') + span(s.punctuation, '(') + span(s.variable, 'token') + span(s.punctuation, ',') + ' ' + span(s.variable, 'config', true) + span(s.punctuation, '.') + span(s.property, 'secret') + span(s.punctuation, ')'));
lines.push(' ' + span(s.keyword, 'return', true) + ' ' + span(s.variable, 'payload') + ' ' + span(s.operator, '!==') + ' ' + span(s.constant, 'null'));
lines.push(' ' + span(s.punctuation, '}') + ' ' + span(s.keyword, 'catch', true) + ' ' + span(s.punctuation, '(') + span(s.variable, 'err', true) + span(s.punctuation, ')') + ' ' + span(s.punctuation, '{'));
lines.push(' ' + span(s.variable, 'console') + span(s.punctuation, '.') + span(s.function, 'error') + span(s.punctuation, '(') + span(s.string, '`Auth failed: ') + span(s.string, '${') + span(s.variable, 'err', true) + span(s.punctuation, '.') + span(s.property, 'message') + span(s.string, '}`') + span(s.punctuation, ')'));
lines.push(' ' + span(s.keyword, 'return', true) + ' ' + span(s.constant, 'false'));
lines.push(' ' + span(s.punctuation, '}'));
lines.push(span(s.punctuation, '}'));
return lines;
}
// ── DOM Rendering ─────────────────────────────────────────────────────────────
function renderThemePanel(p, compact) {
var container = document.createElement('div');
var s = p.syntax;
// Title
var title = document.createElement('h2');
title.style.color = p.accent.primary;
title.style.marginBottom = '1.5rem';
title.textContent = p.name;
container.appendChild(title);
// ── Background Hierarchy ──
container.appendChild(makeSection('Background Hierarchy', function(content) {
var bar = document.createElement('div');
bar.className = 'bg-hierarchy';
var bgKeys = ['primary','secondary','tertiary','active','highlight'];
var bgLabels = ['Primary','Secondary','Tertiary','Active','Highlight'];
bgKeys.forEach(function(k, i) {
var step = document.createElement('div');
step.className = 'bg-step';
step.style.background = p.bg[k];
step.style.color = textColorOn(p.bg[k]);
var label = document.createElement('div');
label.className = 'step-label';
label.textContent = bgLabels[i];
var hex = document.createElement('div');
hex.className = 'step-hex';
hex.textContent = p.bg[k];
step.appendChild(label);
step.appendChild(hex);
bar.appendChild(step);
});
content.appendChild(bar);
}));
// ── Foreground on Background ──
container.appendChild(makeSection('Foreground on Background', function(content) {
var samples = document.createElement('div');
samples.className = 'fg-samples';
['primary','secondary','muted'].forEach(function(k) {
var ratio = contrastRatio(p.fg[k], p.bg.primary);
var pass = parseFloat(ratio) >= 4.5;
var sample = document.createElement('div');
sample.className = 'fg-sample';
sample.style.background = p.bg.primary;
sample.style.color = p.fg[k];
var label = document.createElement('div');
label.className = 'fg-label';
label.textContent = 'fg.' + k + ' on bg.primary';
sample.appendChild(label);
var text = document.createElement('div');
text.textContent = 'The quick brown fox jumps over the lazy dog';
sample.appendChild(text);
var ratioEl = document.createElement('div');
ratioEl.style.color = pass ? '#4ade80' : '#f87171';
ratioEl.style.fontSize = '0.7rem';
ratioEl.style.marginTop = '0.25rem';
ratioEl.style.fontFamily = 'monospace';
ratioEl.textContent = ratio + ':1 ' + (pass ? 'AA' : 'FAIL');
sample.appendChild(ratioEl);
samples.appendChild(sample);
});
content.appendChild(samples);
}));
// ── Accent & Selection ──
container.appendChild(makeSection('Accent & Selection', function(content) {
var grid = document.createElement('div');
grid.className = 'section-grid';
var items = [
['accent.primary', p.accent.primary],
['accent.selection', p.accent.selection],
['accent.selectionInactive', p.accent.selectionInactive],
['border', p.border]
];
items.forEach(function(item) {
grid.appendChild(makeSwatch(item[0], item[1]));
});
content.appendChild(grid);
}));
// ── Syntax Colors ──
container.appendChild(makeSection('Syntax Colors', function(content) {
var grid = document.createElement('div');
grid.className = 'section-grid';
Object.keys(s).forEach(function(key) {
grid.appendChild(makeSwatch(key, s[key]));
});
content.appendChild(grid);
}));
// ── Code Preview ──
container.appendChild(makeSection('Code Preview — TypeScript', function(content) {
var preview = document.createElement('div');
preview.className = 'code-preview';
var titlebar = document.createElement('div');
titlebar.className = 'code-titlebar';
titlebar.style.background = p.bg.secondary;
titlebar.style.color = p.fg.muted;
titlebar.style.borderColor = p.border;
['#ff5f56','#ffbd2e','#27c93f'].forEach(function(c) {
var dot = document.createElement('span');
dot.className = 'dot';
dot.style.background = c;
titlebar.appendChild(dot);
});
var fname = document.createElement('span');
fname.style.marginLeft = '0.5rem';
fname.textContent = 'auth.ts';
titlebar.appendChild(fname);
preview.appendChild(titlebar);
var body = document.createElement('div');
body.className = 'code-body';
body.style.background = p.bg.primary;
var codeLines = buildCodeSample(p);
codeLines.forEach(function(lineHtml, i) {
var lineDiv = document.createElement('div');
lineDiv.className = 'line';
var numSpan = document.createElement('span');
numSpan.className = 'line-num';
numSpan.style.color = p.fg.muted;
numSpan.textContent = String(i + 1);
lineDiv.appendChild(numSpan);
// The code spans are built from hardcoded palette data (no user input)
var codeSpan = document.createElement('span');
codeSpan.innerHTML = lineHtml || ' ';
lineDiv.appendChild(codeSpan);
body.appendChild(lineDiv);
});
preview.appendChild(body);
content.appendChild(preview);
}));
// ── Editor Mockup (single view only) ──
if (!compact) {
container.appendChild(makeSection('Editor Mockup', function(content) {
var mockup = document.createElement('div');
mockup.className = 'editor-mockup';
mockup.style.borderColor = p.border;
// Activity bar
var activity = document.createElement('div');
activity.className = 'editor-activity';
activity.style.background = p.ui.activityBar;
['files','search','git','debug','extensions'].forEach(function(name, i) {
var icon = document.createElement('div');
icon.className = 'icon' + (i === 0 ? ' active' : '');
icon.style.background = i === 0 ? p.ui.activityBarActive : p.ui.activityBarFg;
icon.style.opacity = i === 0 ? '1' : '0.4';
icon.style.borderRadius = '4px';
activity.appendChild(icon);
});
var spacer = document.createElement('div');
spacer.style.flex = '1';
activity.appendChild(spacer);
var bottomIcon = document.createElement('div');
bottomIcon.className = 'icon';
bottomIcon.style.background = p.ui.activityBarFg;
bottomIcon.style.opacity = '0.3';
bottomIcon.style.borderRadius = '4px';
activity.appendChild(bottomIcon);
mockup.appendChild(activity);
// Sidebar
var sidebar = document.createElement('div');
sidebar.className = 'editor-sidebar';
sidebar.style.background = p.bg.secondary;
sidebar.style.borderColor = p.border;
sidebar.style.color = p.fg.secondary;
var sideHeader = document.createElement('div');
sideHeader.className = 'sidebar-header';
sideHeader.style.color = p.fg.muted;
sideHeader.textContent = 'Explorer';
sidebar.appendChild(sideHeader);
var files = ['palettes/', ' drift-ocean.json', ' drift-midnight.json', ' drift-dusk.json', ' drift-forest.json', ' drift-shore.json', ' _template.json', 'scripts/', ' build.js', ' validate.js', 'themes/', 'package.json', 'README.md'];
files.forEach(function(f) {
var isActive = f.indexOf('drift-ocean') >= 0;
var item = document.createElement('div');
item.className = 'sidebar-item' + (isActive ? ' active' : '');
if (isActive) {
item.style.background = p.ui.listActive;
item.style.color = p.fg.primary;
}
item.textContent = f;
sidebar.appendChild(item);
});
mockup.appendChild(sidebar);
// Main editor area
var main = document.createElement('div');
main.className = 'editor-main';
// Tabs
var tabs = document.createElement('div');
tabs.className = 'editor-tabs';
tabs.style.background = p.ui.tab;
tabs.style.borderColor = p.border;
var tab1 = document.createElement('div');
tab1.className = 'editor-tab active';
tab1.style.background = p.ui.tabActive;
tab1.style.color = p.fg.primary;
tab1.style.borderColor = p.border;
tab1.style.borderBottomColor = p.accent.primary;
tab1.textContent = 'auth.ts';
tabs.appendChild(tab1);
var tab2 = document.createElement('div');
tab2.className = 'editor-tab';
tab2.style.color = p.fg.muted;
tab2.style.borderColor = p.border;
tab2.textContent = 'config.ts';
tabs.appendChild(tab2);
main.appendChild(tabs);
// Code area
var codeArea = document.createElement('div');
codeArea.className = 'editor-code';
codeArea.style.background = p.bg.primary;
codeArea.style.color = p.fg.primary;
codeArea.style.fontFamily = "'Victor Mono', 'Cascadia Code', 'JetBrains Mono', monospace";
var editorLines = buildCodeSample(p).slice(0, 18);
editorLines.forEach(function(lineHtml, i) {
var lineDiv = document.createElement('div');
lineDiv.className = 'line';
if (i === 13) lineDiv.style.background = p.bg.active;
var codeSpan = document.createElement('span');
codeSpan.innerHTML = lineHtml || ' ';
lineDiv.appendChild(codeSpan);
codeArea.appendChild(lineDiv);
});
main.appendChild(codeArea);
// Status bar
var statusbar = document.createElement('div');
statusbar.className = 'editor-statusbar';
statusbar.style.background = p.ui.statusBar;
statusbar.style.color = p.ui.statusBarFg;
statusbar.style.borderTop = '1px solid ' + p.border;
var leftStatus = document.createElement('span');
var badge = document.createElement('span');
badge.style.background = p.ui.badge;
badge.style.color = p.ui.badgeFg;
badge.style.padding = '1px 6px';
badge.style.borderRadius = '3px';
badge.style.fontSize = '0.6rem';
badge.textContent = 'main';
leftStatus.appendChild(badge);
leftStatus.appendChild(document.createTextNode(' Ln 14, Col 1'));
statusbar.appendChild(leftStatus);
var rightStatus = document.createElement('span');
rightStatus.textContent = 'TypeScript UTF-8 LF';
statusbar.appendChild(rightStatus);
main.appendChild(statusbar);
mockup.appendChild(main);
content.appendChild(mockup);
}));
}
// ── Terminal Preview ──
container.appendChild(makeSection('Terminal', function(content) {
var term = document.createElement('div');
term.className = 'terminal-preview';
var titlebar = document.createElement('div');
titlebar.className = 'terminal-titlebar';
titlebar.style.background = p.bg.secondary;
titlebar.style.color = p.fg.muted;
titlebar.style.borderBottom = '1px solid ' + p.border;
['#ff5f56','#ffbd2e','#27c93f'].forEach(function(c) {
var dot = document.createElement('span');
dot.className = 'dot';
dot.style.background = c;
dot.style.width = '8px';
dot.style.height = '8px';
dot.style.borderRadius = '50%';
dot.style.display = 'inline-block';
titlebar.appendChild(dot);
});
var termLabel = document.createElement('span');
termLabel.style.marginLeft = '0.5rem';
termLabel.textContent = 'Terminal';
titlebar.appendChild(termLabel);
term.appendChild(titlebar);
var tbody = document.createElement('div');
tbody.className = 'terminal-body';
tbody.style.background = p.bg.primary;
var termLines = [
[
[p.terminal.green, 'kelleyc'],
[p.terminal.white, ':'],
[p.terminal.blue, '~/vs_theme'],
[p.terminal.white, '$ '],
[p.fg.primary, 'npm test']
],
[[p.fg.secondary, ' ']],
[
[p.terminal.cyan, 'Building: '],
[p.fg.primary, 'deep-ocean '],
[p.terminal.green, 'OK']
],
[
[p.terminal.cyan, 'Building: '],
[p.fg.primary, 'midnight '],
[p.terminal.green, 'OK']
],
[[p.fg.secondary, ' ']],
[
[p.terminal.green, 'Validation passed: '],
[p.terminal.yellow, '0 errors'],
[p.fg.muted, ', '],
[p.terminal.yellow, '0 warnings']
],
[
[p.terminal.red, 'ERROR'],
[p.fg.muted, ': '],
[p.fg.primary, 'Something went wrong (demo)']
],
[
[p.terminal.magenta, 'WARNING'],
[p.fg.muted, ': '],
[p.fg.primary, 'Deprecated API usage (demo)']
]
];
termLines.forEach(function(parts) {
var line = document.createElement('div');
parts.forEach(function(part) {
var sp = document.createElement('span');
sp.style.color = part[0];
sp.textContent = part[1];
line.appendChild(sp);
});
tbody.appendChild(line);
});
term.appendChild(tbody);
content.appendChild(term);
}));
// ── ANSI Colors ──
container.appendChild(makeSection('ANSI Terminal Colors', function(content) {
var grid = document.createElement('div');
grid.className = 'ansi-grid';
var ansiOrder = ['black','red','green','yellow','blue','magenta','cyan','white'];
ansiOrder.forEach(function(k) {
var cell = document.createElement('div');
cell.className = 'ansi-cell';
cell.style.background = p.terminal[k];
cell.style.color = textColorOn(p.terminal[k]);
cell.textContent = k + '\n' + p.terminal[k];
grid.appendChild(cell);
});
ansiOrder.forEach(function(k) {
var bk = 'bright' + k.charAt(0).toUpperCase() + k.slice(1);
var cell = document.createElement('div');
cell.className = 'ansi-cell';
cell.style.background = p.terminal[bk];
cell.style.color = textColorOn(p.terminal[bk]);
cell.textContent = 'bright' + k + '\n' + p.terminal[bk];
grid.appendChild(cell);
});
content.appendChild(grid);
}));
// ── UI Elements ──
container.appendChild(makeSection('UI Elements', function(content) {
var grid = document.createElement('div');
grid.className = 'section-grid';
Object.keys(p.ui).forEach(function(key) {
grid.appendChild(makeSwatch(key, p.ui[key]));
});
content.appendChild(grid);
}));
return container;
}
// ── Helper: create a section ──
function makeSection(title, buildFn) {
var section = document.createElement('div');
section.className = 'section';
var h3 = document.createElement('h3');
h3.textContent = title;
section.appendChild(h3);
buildFn(section);
return section;
}
// ── Helper: create a color swatch ──
function makeSwatch(label, color) {
var swatch = document.createElement('div');
swatch.className = 'swatch';
var colorDiv = document.createElement('div');
colorDiv.className = 'swatch-color';
colorDiv.style.background = color;
var hexSpan = document.createElement('span');
hexSpan.className = 'hex';
hexSpan.style.color = textColorOn(color);
hexSpan.textContent = color;
colorDiv.appendChild(hexSpan);
swatch.appendChild(colorDiv);
var labelDiv = document.createElement('div');
labelDiv.className = 'swatch-label';
labelDiv.textContent = label;
swatch.appendChild(labelDiv);
return swatch;
}
// ── Navigation & View Logic ───────────────────────────────────────────────────
var activeTheme = 0;
var viewMode = 'single';
function buildNav() {
var nav = document.getElementById('themeNav');
while (nav.firstChild) nav.removeChild(nav.firstChild);
palettes.forEach(function(p, i) {
var btn = document.createElement('button');
btn.textContent = p.name;
btn.className = i === activeTheme ? 'active' : '';
btn.addEventListener('click', function() { activeTheme = i; render(); });
nav.appendChild(btn);
});
}
// View toggle buttons
document.querySelectorAll('#viewToggle button').forEach(function(btn) {
btn.addEventListener('click', function() {
var mode = btn.getAttribute('data-mode');
viewMode = mode;
document.querySelectorAll('#viewToggle button').forEach(function(b, i) {
b.className = (i === 0 && mode === 'single') || (i === 1 && mode === 'compare') ? 'active' : '';
});
render();
});
});
function render() {
buildNav();
var single = document.getElementById('singleView');
var compare = document.getElementById('compareView');
var panel = document.getElementById('panel-0');
var compLeft = document.getElementById('compare-left');
var compRight = document.getElementById('compare-right');
// Adapt page background to theme type
var isLight = palettes[activeTheme].type === 'light';
document.body.style.background = isLight ? '#e8e8e8' : '#111';
document.body.style.color = isLight ? '#333' : '#ccc';
document.querySelectorAll('h1').forEach(function(el) { el.style.color = isLight ? '#111' : '#fff'; });
document.querySelectorAll('h3').forEach(function(el) { el.style.color = isLight ? '#666' : '#999'; });
document.querySelectorAll('.subtitle').forEach(function(el) { el.style.color = isLight ? '#666' : '#777'; });
document.querySelectorAll('.swatch-label').forEach(function(el) {
el.style.background = isLight ? '#e0e0e0' : '#1a1a1a';
el.style.color = isLight ? '#555' : '#999';
});
document.querySelectorAll('.nav button').forEach(function(el) {
el.style.background = isLight ? '#ddd' : '#1a1a1a';
el.style.borderColor = isLight ? '#bbb' : '#333';
el.style.color = isLight ? '#333' : '#ccc';
});
document.querySelectorAll('#viewToggle button').forEach(function(el) {
el.style.background = isLight ? '#ddd' : '#1a1a1a';
el.style.borderColor = isLight ? '#bbb' : '#333';
el.style.color = isLight ? '#555' : '#888';
});
if (viewMode === 'single') {
single.style.display = 'block';
compare.className = 'compare-view';
while (panel.firstChild) panel.removeChild(panel.firstChild);
panel.appendChild(renderThemePanel(palettes[activeTheme], false));
panel.className = 'theme-panel active';
} else {
single.style.display = 'none';
compare.className = 'compare-view active';
var left = activeTheme;
var right = (activeTheme + 1) % palettes.length;
while (compLeft.firstChild) compLeft.removeChild(compLeft.firstChild);
while (compRight.firstChild) compRight.removeChild(compRight.firstChild);
compLeft.appendChild(renderThemePanel(palettes[left], true));
compRight.appendChild(renderThemePanel(palettes[right], true));
}
}
// ── Init ──
render();
</script>
</body>
</html>