Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

themePalette.test.ts

568 lines21.0 KB

1import { describe, expect, it, vi } from "vite-plus/test";
2​
3import {
4 applyThemeColorPreview,
5 applyThemePalette,
6 getThemeColorsForMode,
7 getThemeDefinition,
8 getThemeModes,
9 getThemePreviewSidebarArtwork,
10 getThemePreferenceMode,
11 isKnownThemePreference,
12 getCustomThemes,
13 invalidateCustomThemes,
14 installCustomTheme,
15 canonicalThemePreference,
16 parseThemeFile,
17 parseThemeHalves,
18 resolveDesktopTheme,
19 resolveThemeAppearance,
20 serializeThemeFile,
21 subscribeToThemePreview,
22 subscribeToCustomThemes,
23 T3_CHAT_THEME,
24 EMBER_THEME,
25 GROVE_THEME,
26 IRIS_THEME,
27 OCEAN_THEME,
28 updateCustomTheme,
29 CUSTOM_THEMES_STORAGE_KEY,
30 createManagedThemeColors,
31 createVividThemeColors,
32 getDefaultThemeColors,
33 THEME_FILE_VERSION,
34} from "./themePalette";
35​
36function contrastRatio(first: string, second: string): number {
37 const toRgb = (value: string) => {
38 const hex = value.slice(1);
39 return [0, 1, 2].map(
40 (channel) => Number.parseInt(hex.slice(channel * 2, channel * 2 + 2), 16) / 255,
41 );
42 };
43 const luminance = (value: string) =>
44 toRgb(value)
45 .map((channel) => (channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4))
46 .reduce((sum, channel, index) => sum + channel * [0.2126, 0.7152, 0.0722][index]!, 0);
47 const lighter = Math.max(luminance(first), luminance(second));
48 const darker = Math.min(luminance(first), luminance(second));
49 return (lighter + 0.05) / (darker + 0.05);
51​
52describe("theme files", () => {
53 it("derives a readable palette from extreme simple-editor colors", () => {
54 const light = createManagedThemeColors("light", "#111827", "#ffff00");
55 const dark = createManagedThemeColors("dark", "#ffffff", "#ffff00");
56 const darkDefaults = getDefaultThemeColors("dark");
57​
58 expect(light.canvas).not.toBe("#111827");
59 expect(dark.canvas).not.toBe("#ffffff");
60 expect(contrastRatio(light.accent, light.canvas)).toBeGreaterThanOrEqual(4.5);
61 expect(contrastRatio(dark.accent, dark.canvas)).toBeGreaterThanOrEqual(4.5);
62 expect(contrastRatio(light.textMuted, light.canvas)).toBeGreaterThanOrEqual(4.5);
63 expect(contrastRatio(dark.textMuted, dark.canvas)).toBeGreaterThanOrEqual(4.5);
64 expect(contrastRatio(light.textMuted, light.canvas)).toBeLessThan(5.5);
65 expect(contrastRatio(dark.textMuted, dark.canvas)).toBeLessThan(5.5);
66 expect(contrastRatio(light.textMuted, light.canvas)).toBeCloseTo(4.705, 1);
67 expect(contrastRatio(dark.textMuted, dark.canvas)).toBeCloseTo(5.082, 1);
68 expect(light.secondaryLabel).toBe(light.textMuted);
69 expect(dark.secondaryLabel).toBe(dark.textMuted);
70 expect(contrastRatio(light.accentForeground, light.accent)).toBeGreaterThanOrEqual(4.5);
71 expect(contrastRatio(dark.accentForeground, dark.accent)).toBeGreaterThanOrEqual(4.5);
72 // Status colors fall back to T3 Code's standard red and amber rather than
73 // the flagship palette's, so no generated theme inherits a brand tint.
74 const channels = (value: string) =>
75 [1, 3, 5].map((index) => Number.parseInt(value.slice(index, index + 2), 16)) as [
76 number,
77 number,
78 number,
79 ];
80 for (const colors of [light, dark]) {
81 const [errorRed, errorGreen, errorBlue] = channels(colors.error);
82 // Red leads by a wide margin; the old default was a pink whose blue sat
83 // close behind its red.
84 expect(errorRed).toBeGreaterThan(errorGreen * 2);
85 expect(errorRed).toBeGreaterThan(errorBlue * 2);
86 expect(contrastRatio(colors.error, "#ffffff")).toBeGreaterThanOrEqual(2.5);
87 expect(contrastRatio(colors.errorForeground, colors.errorSurface)).toBeGreaterThanOrEqual(
88 4.5,
89 );
90 const [warnRed, warnGreen, warnBlue] = channels(colors.warning);
91 expect(warnRed).toBeGreaterThan(warnBlue);
92 expect(warnGreen).toBeGreaterThan(warnBlue);
93 }
94 expect(dark.error).not.toBe(darkDefaults.error);
95 });
96​
97 it("derives readable, distinctive vivid palettes from exact seeds", () => {
98 const seeds: ReadonlyArray<["light" | "dark", string, string]> = [
99 ["light", "#f4f9f2", "#1d8a4e"],
100 ["dark", "#101a2c", "#4f8fe8"],
101 ["dark", "#211a23", "#df5398"],
102 ["light", "#fdf6ec", "#c2571b"],
103 // Inverted canvases: the palette follows the picked color, not the slot.
104 ["light", "#111827", "#8ab4f8"],
105 ["dark", "#f5ecf5", "#a84370"],
106 ];
107 for (const [appearance, canvas, accent] of seeds) {
108 const colors = createVividThemeColors(appearance, canvas, accent);
109 // Exact seeds are honored.
110 expect(colors.canvas).toBe(canvas);
111 expect(colors.accent).toBe(accent);
112 // Readability is solved per surface.
113 expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
114 expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
115 expect(contrastRatio(colors.textMuted, colors.canvas)).toBeLessThan(5.5);
116 expect(contrastRatio(colors.mutedForeground, colors.muted)).toBeGreaterThanOrEqual(4.5);
117 expect(contrastRatio(colors.placeholder, colors.surfaceRaised)).toBeGreaterThanOrEqual(4.5);
118 expect(colors.secondaryLabel).toBe(colors.textMuted);
119 expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
120 expect(
121 contrastRatio(colors.messageActionForeground, colors.messageAction),
122 ).toBeGreaterThanOrEqual(4.5);
123 expect(contrastRatio(colors.messageForeground, colors.messageSurface)).toBeGreaterThanOrEqual(
124 4.5,
125 );
126 expect(contrastRatio(colors.secondaryForeground, colors.secondary)).toBeGreaterThanOrEqual(
127 4.5,
128 );
129 expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
130 // The companion action is a distinct voice, not the accent again.
131 expect(colors.messageAction).not.toBe(colors.accent);
132 // Update family follows the theme, not the default palette.
133 expect(colors.update).toBe(accent);
134 }
135 });
136​
137 it("keys status colors off the canvas, not the appearance slot", () => {
138 // Inverted seeds: a dark canvas in the light slot must still get the dark
139 // status pair, or the alert foreground lands on a dark surface unreadable.
140 const inverted = [
141 createVividThemeColors("light", "#111827", "#8ab4f8"),
142 createVividThemeColors("dark", "#f5ecf5", "#a84370"),
143 createManagedThemeColors("light", "#0d1117", "#69b1ff", { exactSeeds: true }),
144 createManagedThemeColors("dark", "#fdfdfd", "#c2571b", { exactSeeds: true }),
145 ];
146 for (const colors of inverted) {
147 expect(contrastRatio(colors.errorForeground, colors.errorSurface)).toBeGreaterThanOrEqual(
148 4.5,
149 );
150 expect(contrastRatio(colors.warningForeground, colors.warningSurface)).toBeGreaterThanOrEqual(
151 4.5,
152 );
153 }
154 });
155​
156 it("merges a small user file onto the matching contrast-safe base palette", () => {
157 const theme = parseThemeFile({
158 version: THEME_FILE_VERSION,
159 name: "Ocean dusk",
160 appearance: "dark",
161 colors: {
162 canvas: "#07152f",
163 accent: "#67c2ff",
164 },
165 });
166​
167 expect(theme).toMatchObject({
168 id: "ocean-dusk",
169 label: "Ocean dusk",
170 appearance: "dark",
171 colors: {
172 canvas: "#07152f",
173 accent: "#67c2ff",
174 placeholder: "#968d9f",
175 },
176 });
177 });
178​
179 it("rejects unknown roles and invalid color values", () => {
180 expect(() =>
181 parseThemeFile({
182 version: THEME_FILE_VERSION,
183 name: "Broken",
184 appearance: "light",
185 colors: { background: "#ffffff" },
186 }),
187 ).toThrow('"background" is not a supported theme color role.');
188​
189 expect(() =>
190 parseThemeFile({
191 version: THEME_FILE_VERSION,
192 name: "Broken",
193 appearance: "light",
194 colors: { accent: "var(--danger)" },
195 }),
196 ).toThrow('The color for "accent" must be a hex color');
197 });
198​
199 it("serializes a theme back into the importable file shape", () => {
200 const serialized = serializeThemeFile(T3_CHAT_THEME);
201 expect(JSON.parse(serialized)).toMatchObject({
202 version: THEME_FILE_VERSION,
203 id: T3_CHAT_THEME.id,
204 name: T3_CHAT_THEME.label,
205 appearance: "light",
206 });
207 });
208​
209 it("keeps sidebar artwork opt-in through theme files", () => {
210 const withoutArtwork = parseThemeFile({
211 version: THEME_FILE_VERSION,
212 name: "Plain sidebar",
213 appearance: "light",
214 colors: { accent: "#5b6cff" },
215 });
216 const withArtwork = parseThemeFile({
217 version: THEME_FILE_VERSION,
218 name: "Art sidebar",
219 appearance: "light",
220 colors: { accent: "#5b6cff" },
221 sidebarArtwork: true,
222 });
223​
224 expect(withoutArtwork.sidebarArtwork).toBeUndefined();
225 expect(withArtwork.sidebarArtwork).toBe(true);
226 expect(JSON.parse(serializeThemeFile(withArtwork)).sidebarArtwork).toBe(true);
227 });
228​
229 it("publishes sidebar artwork changes from the live theme preview", () => {
230 const listener = vi.fn();
231 const unsubscribe = subscribeToThemePreview(listener);
232 vi.stubGlobal("document", {
233 documentElement: {
234 classList: { toggle: vi.fn() },
235 dataset: {},
236 style: { removeProperty: vi.fn(), setProperty: vi.fn() },
237 },
238 });
239​
240 applyThemeColorPreview(T3_CHAT_THEME.colors, "light", true);
241 expect(getThemePreviewSidebarArtwork()).toBe(true);
242 expect(listener).toHaveBeenCalledTimes(1);
243​
244 applyThemePalette("system");
245 expect(getThemePreviewSidebarArtwork()).toBeNull();
246 expect(listener).toHaveBeenCalledTimes(2);
247​
248 unsubscribe();
249 vi.unstubAllGlobals();
250 });
251​
252 it("keeps optional light and dark palettes under one theme id", () => {
253 const theme = parseThemeFile({
254 version: THEME_FILE_VERSION,
255 id: "aurora",
256 name: "Aurora",
257 appearance: "light",
258 colors: { canvas: "#f8fbff", text: "#10243d" },
259 variants: {
260 dark: { canvas: "#101827", text: "#eef5ff" },
261 },
262 });
263​
264 expect(getThemeModes(theme)).toEqual(["light", "dark"]);
265 expect(getThemeColorsForMode(theme, "dark")).toMatchObject({
266 canvas: "#101827",
267 text: "#eef5ff",
268 });
269 expect(getThemeModes(T3_CHAT_THEME)).toEqual(["light", "dark"]);
270 expect(resolveThemeAppearance(T3_CHAT_THEME.id, true, true)).toBe("dark");
271 expect(resolveDesktopTheme(T3_CHAT_THEME.id, true)).toBe("system");
272 expect(resolveThemeAppearance(T3_CHAT_THEME.id, false, false, "dark")).toBe("dark");
273 expect(resolveDesktopTheme(T3_CHAT_THEME.id, false, "dark")).toBe("dark");
274 expect(JSON.parse(serializeThemeFile(theme)).variants.dark).toMatchObject({
275 canvas: "#101827",
276 text: "#eef5ff",
277 });
278 });
279​
280 it("keeps the T3 Chat palette faithful and readable", () => {
281 expect(T3_CHAT_THEME.colors).toMatchObject({
282 canvas: "#fdf7fd",
283 chrome: "#fdf7fd",
284 toolbarBorder: "#efbdeb",
285 toolbarControl: "#f3e6f5",
286 toolbarControlHover: "#eccfe3",
287 surfaceRaised: "#fdfafd",
288 input: "#e7c1dc",
289 focus: "#db2777",
290 messageSurface: "#f7def2",
291 codeBackground: "#f5ecf9",
292 codeForeground: "#673c8b",
293 accentSurface: "#f3e6f5",
294 sidebar: "#f2e1f4",
295 });
296 expect(T3_CHAT_THEME.variants?.dark).toMatchObject({
297 canvas: "#1f1a24",
298 chrome: "#1f1a24",
299 surface: "#29232d",
300 surfaceRaised: "#2c2631",
301 input: "#302029",
302 focus: "#db2777",
303 messageSurface: "#2b2431",
304 codeBackground: "#1f1a24",
305 sidebar: "#171018",
306 sidebarBorder: "#322028",
307 });
308​
309 for (const mode of ["light", "dark"] as const) {
310 const colors = getThemeColorsForMode(T3_CHAT_THEME, mode)!;
311 expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
312 expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
313 expect(contrastRatio(colors.messageForeground, colors.messageSurface)).toBeGreaterThanOrEqual(
314 4.5,
315 );
316 expect(contrastRatio(colors.secondaryForeground, colors.secondary)).toBeGreaterThanOrEqual(
317 4.5,
318 );
319 expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
320 expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
321 }
322 });
323​
324 it("includes the dual-mode maintainer themes", () => {
325 for (const theme of [T3_CHAT_THEME, GROVE_THEME, OCEAN_THEME, EMBER_THEME, IRIS_THEME]) {
326 expect(getThemeDefinition(theme.id)).toBe(theme);
327 expect(getThemeModes(theme)).toEqual(["light", "dark"]);
328 expect(theme.colors.accent).toMatch(/^#[0-9a-f]{6}$/i);
329 expect(theme.variants?.dark?.accent).toMatch(/^#[0-9a-f]{6}$/i);
330​
331 for (const mode of ["light", "dark"] as const) {
332 const colors = getThemeColorsForMode(theme, mode);
333 expect(colors).not.toBeNull();
334 expect(contrastRatio(colors!.text, colors!.canvas)).toBeGreaterThanOrEqual(4.5);
335 expect(contrastRatio(colors!.textMuted, colors!.canvas)).toBeGreaterThanOrEqual(4.5);
336 if (theme !== T3_CHAT_THEME) {
337 expect(contrastRatio(colors!.textMuted, colors!.canvas)).toBeLessThan(5.5);
338 expect(contrastRatio(colors!.textMuted, colors!.canvas)).toBeCloseTo(
339 mode === "dark" ? 5.082 : 4.705,
340 1,
341 );
342 }
343 expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
344 expect(
345 contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
346 ).toBeGreaterThanOrEqual(4.5);
347 expect(
348 contrastRatio(colors!.messageForeground, colors!.messageSurface),
349 ).toBeGreaterThanOrEqual(4.5);
350 expect(
351 contrastRatio(colors!.messageActionForeground, colors!.messageAction),
352 ).toBeGreaterThanOrEqual(4.5);
353 expect(
354 contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
355 ).toBeGreaterThanOrEqual(4.5);
356 expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
357 expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
358 4.5,
359 );
360 }
361 }
362 });
363​
364 it("rejects a variant that repeats the base appearance", () => {
365 expect(() =>
366 parseThemeFile({
367 version: THEME_FILE_VERSION,
368 name: "Duplicate light",
369 appearance: "light",
370 colors: { canvas: "#f8fbff" },
371 variants: { light: { canvas: "#101827" } },
372 }),
373 ).toThrow('Theme variants must not repeat the base appearance "light".');
374 });
375​
376 it("keeps a single-mode theme on its only palette", () => {
377 const theme = parseThemeFile({
378 version: THEME_FILE_VERSION,
379 id: "midnight-slate",
380 name: "Midnight Slate",
381 appearance: "dark",
382 colors: { canvas: "#111827", messageAction: "#2563eb" },
383 });
384​
385 expect(getThemeModes(theme)).toEqual(["dark"]);
386 expect(getThemeColorsForMode(theme, "dark")).toMatchObject({ canvas: "#111827" });
387 expect(getThemeColorsForMode(theme, "light")).toBeNull();
388 });
389​
390 it("invalidates cached themes when another tab clears localStorage", () => {
391 let storedThemes: string | null = JSON.stringify([
392 {
393 id: "ocean-dusk",
394 label: "Ocean dusk",
395 appearance: "dark",
396 colors: { canvas: "#07152f" },
397 },
398 ]);
399 let storageHandler: ((event: StorageEvent) => void) | undefined;
400 vi.stubGlobal("window", {
401 addEventListener: (type: string, listener: (event: StorageEvent) => void) => {
402 if (type === "storage") storageHandler = listener;
403 },
404 removeEventListener: vi.fn(),
405 localStorage: {
406 getItem: (key: string) => (key === CUSTOM_THEMES_STORAGE_KEY ? storedThemes : null),
407 },
408 });
409​
410 invalidateCustomThemes();
411 expect(getCustomThemes()).toHaveLength(1);
412 const listener = vi.fn();
413 const unsubscribe = subscribeToCustomThemes(listener);
414​
415 storedThemes = null;
416 storageHandler?.({ key: null } as StorageEvent);
417​
418 expect(listener).toHaveBeenCalledTimes(1);
419 expect(getCustomThemes()).toEqual([]);
420 unsubscribe();
421 invalidateCustomThemes();
422 vi.unstubAllGlobals();
423 });
424​
425 it("updates a personal theme without changing its id", () => {
426 const stored = new Map<string, string>();
427 vi.stubGlobal("window", {
428 localStorage: {
429 getItem: (key: string) => stored.get(key) ?? null,
430 setItem: (key: string, value: string) => stored.set(key, value),
431 },
432 });
433​
434 invalidateCustomThemes();
435 const createdTheme = installCustomTheme(
436 parseThemeFile({
437 version: THEME_FILE_VERSION,
438 id: "aurora",
439 name: "Aurora",
440 appearance: "light",
441 colors: { canvas: "#f8fbff", accent: "#5b6cff" },
442 sidebarArtwork: true,
443 }),
444 );
445 const updatedTheme = updateCustomTheme({
446 ...createdTheme,
447 label: "Aurora Night",
448 colors: { ...createdTheme.colors, accent: "#7c3aed" },
449 });
450​
451 expect(updatedTheme).toMatchObject({
452 id: "aurora",
453 label: "Aurora Night",
454 sidebarArtwork: true,
455 });
456 invalidateCustomThemes();
457 expect(getCustomThemes()).toEqual([updatedTheme]);
458 expect(JSON.parse(stored.get(CUSTOM_THEMES_STORAGE_KEY) ?? "[]")[0]).toMatchObject({
459 id: "aurora",
460 label: "Aurora Night",
461 sidebarArtwork: true,
462 });
463​
464 vi.unstubAllGlobals();
465 invalidateCustomThemes();
466 });
467});
468​
469describe("stored theme preferences", () => {
470 it("lets a configured half unlock an appearance the base theme lacks", () => {
471 // Light-only base: without halves, dark requests fall back to light.
472 const lightOnly = parseThemeFile({
473 version: THEME_FILE_VERSION,
474 id: "paper",
475 name: "Paper",
476 appearance: "light",
477 colors: { canvas: "#f8fbff" },
478 });
479 vi.stubGlobal("window", {
480 localStorage: {
481 getItem: (key: string) =>
482 key === CUSTOM_THEMES_STORAGE_KEY ? JSON.stringify([lightOnly]) : null,
483 },
484 });
485 invalidateCustomThemes();
486 try {
487 expect(resolveThemeAppearance("paper", true, true)).toBe("light");
488 const halves = { dark: GROVE_THEME.id };
489 expect(resolveThemeAppearance("paper", true, true, undefined, halves)).toBe("dark");
490 expect(resolveThemeAppearance("paper", false, false, "dark", halves)).toBe("dark");
491 expect(resolveDesktopTheme("paper", true, undefined, halves)).toBe("system");
492 } finally {
493 vi.unstubAllGlobals();
494 invalidateCustomThemes();
495 }
496 });
497​
498 it("resolves the legacy t3-chat-dark preference to dark T3 Chat", () => {
499 expect(getThemeDefinition("t3-chat-dark")).toBe(T3_CHAT_THEME);
500 expect(getThemePreferenceMode("t3-chat-dark")).toBe("dark");
501 expect(resolveThemeAppearance("t3-chat-dark", true, false)).toBe("dark");
502 expect(resolveDesktopTheme("t3-chat-dark", false)).toBe("dark");
503 expect(isKnownThemePreference("t3-chat-dark")).toBe(true);
504 });
505​
506 it("resolves legacy t3-prefixed ids onto the renamed themes", () => {
507 for (const [legacy, theme] of [
508 ["t3-grove", GROVE_THEME],
509 ["t3-ocean", OCEAN_THEME],
510 ["t3-ember", EMBER_THEME],
511 ["t3-iris", IRIS_THEME],
512 ] as const) {
513 expect(getThemeDefinition(legacy)).toBe(theme);
514 expect(isKnownThemePreference(legacy)).toBe(true);
515 expect(canonicalThemePreference(legacy)).toBe(theme.id);
516 }
517 // The dark-variant alias keeps its raw form: it still carries a mode hint.
518 expect(canonicalThemePreference("t3-chat-dark")).toBe("t3-chat-dark");
519 // A stored mix that predates the rename resolves to the new ids.
520 expect(parseThemeHalves(JSON.stringify({ light: "t3-ocean", dark: "t3-grove" }))).toEqual({
521 light: OCEAN_THEME.id,
522 dark: GROVE_THEME.id,
523 });
524 });
525​
526 it("recognizes only preferences the runtime can render", () => {
527 for (const preference of ["light", "dark", "system", T3_CHAT_THEME.id, GROVE_THEME.id]) {
528 expect(isKnownThemePreference(preference)).toBe(true);
529 }
530 expect(isKnownThemePreference(`${GROVE_THEME.id}:dark`)).toBe(false);
531 expect(isKnownThemePreference("missing-theme")).toBe(false);
532 });
533​
534 it("keeps stored themes with unknown roles and drops invalid entries", () => {
535 vi.stubGlobal("window", {
536 localStorage: {
537 getItem: (key: string) =>
538 key === CUSTOM_THEMES_STORAGE_KEY
539 ? JSON.stringify([
540 {
541 id: "aurora",
542 label: "Aurora",
543 appearance: "light",
544 colors: { canvas: "#f8fbff", futureRole: "#123456", accent: "not-a-color" },
545 variants: { light: { canvas: "#101827" } },
546 },
547 { id: "light", label: "Reserved", appearance: "light", colors: {} },
548 { id: "aurora", label: "Duplicate", appearance: "dark", colors: {} },
549 ])
550 : null,
551 },
552 });
553 invalidateCustomThemes();
554​
555 const themes = getCustomThemes();
556 expect(themes).toHaveLength(1);
557 expect(themes[0]).toMatchObject({
558 id: "aurora",
559 colors: { canvas: "#f8fbff", accent: getDefaultThemeColors("light").accent },
560 });
561 // The variant shadowing the base appearance is dropped so the theme
562 // round-trips through parseThemeFile on export.
563 expect(getThemeModes(themes[0]!)).toEqual(["light"]);
564​
565 vi.unstubAllGlobals();
566 invalidateCustomThemes();
567 });
568});