@devries-cameron20 / t3code-1 / commits / 81049d2b92
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): importing light and dark theme files together keeps their custom CSS (#38134)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wout Stiens committed Nov 17, 2026 at 14:53 UTC 81049d2b922d7509c4c8a9b12f72632e4a2607c1
3 files changed +94 -4
apps/web/src/vscodeThemeImport.test.ts
+29
@@ -468,6 +468,35 @@ describe("VS Code theme import", () => {
468 expect(getThemeColorsForMode(themes[2]!, "light")).toBeNull();
469 });
470
471 + it.each([
472 + { name: "shared", light: "a {}", dark: "a {}", expected: [["Aurora", "a {}"]] },
473 + { name: "light-only", light: "a {}", dark: undefined, expected: [["Aurora", "a {}"]] },
474 + { name: "dark-only", light: undefined, dark: "a {}", expected: [["Aurora", "a {}"]] },
475 + {
476 + name: "conflicting",
477 + light: "a {}",
478 + dark: "b {}",
479 + expected: [
480 + ["Aurora Light", "a {}"],
481 + ["Aurora Dark", "b {}"],
482 + ],
483 + },
484 + ])("pairs light and dark halves with $name custom CSS", ({ light, dark, expected }) => {
485 + const themes = pairVsCodeThemes(
486 + (["light", "dark"] as const).map((appearance) => {
487 + const css = appearance === "light" ? light : dark;
488 + return parseThemeFile({
489 + version: THEME_FILE_VERSION,
490 + name: `Aurora ${appearance === "light" ? "Light" : "Dark"}`,
491 + appearance,
492 + colors: { canvas: appearance === "light" ? "#fafafa" : "#101014" },
493 + ...(css ? { css } : {}),
494 + });
495 + }),
496 + );
497 + expect(themes.map((theme) => [theme.label, theme.css])).toEqual(expected);
498 + });
499 +
500 it("does not guess when a family is ambiguous", () => {
501 const make = (name: string, type: "light" | "dark") =>
502 parseVsCodeThemeFile({
apps/web/src/vscodeThemeImport.ts
+14 -4
@@ -412,17 +412,27 @@ export function pairVsCodeThemes(
412
413 const paired: Array<{ theme: ThemeDefinition; order: number }> = [];
414 for (const [key, group] of groups) {
415 - if (group.light.length === 1 && group.dark.length === 1) {
415 + const [light] = group.light;
416 + const [dark] = group.dark;
417 + // A theme carries one stylesheet for both modes, so conflicting CSS stays as two themes.
418 + if (
419 + light &&
420 + dark &&
421 + group.light.length === 1 &&
422 + group.dark.length === 1 &&
423 + (!light.css || !dark.css || light.css === dark.css)
424 + ) {
425 try {
426 paired.push({
427 order: group.order,
428 theme: parseThemeFile({
429 version: THEME_FILE_VERSION,
421 - ...(options?.pairedId ? { id: options.pairedId(group.light[0]!, group.dark[0]!) } : {}),
430 + ...(options?.pairedId ? { id: options.pairedId(light, dark) } : {}),
431 name: key,
432 appearance: "light",
424 - colors: group.light[0]!.colors,
425 - variants: { dark: group.dark[0]!.colors },
433 + colors: light.colors,
434 + variants: { dark: dark.colors },
435 + css: light.css ?? dark.css,
436 }),
437 });
438 continue;
scripts/scenarios/theme-batch-pair-keeps-css.e2e.ts new
+51
@@ -0,0 +1,51 @@
1 +import { expect } from "e2e";
2 +
3 +import { test, WEB } from "./t3.ts";
4 +
5 +test(
6 + "Importing light and dark theme files together keeps their shared custom CSS",
7 + WEB,
8 + async ({ t3, app, screen, browser }) => {
9 + await t3.project("demo");
10 + await t3.open("/settings/appearance");
11 + await screen.getByRole("button", "Add theme", { exact: true }).tap();
12 + const dialog = screen.getByRole("dialog", "Add a theme");
13 + await browser.evaluate(() => {
14 + const input = document.querySelector<HTMLInputElement>('input[type="file"]');
15 + if (!input) throw new Error("Theme file input is missing");
16 + const files = new DataTransfer();
17 + for (const appearance of ["light", "dark"] as const) {
18 + const theme = {
19 + version: 1,
20 + name: `Aurora ${appearance === "light" ? "Light" : "Dark"}`,
21 + appearance,
22 + colors: {
23 + canvas: appearance === "light" ? "#fafafa" : "#101014",
24 + accent: "#6d5ae6",
25 + },
26 + css: "[data-settings-page-scroll] { outline: 8px solid #ff2d95; outline-offset: -8px; }",
27 + };
28 + files.items.add(
29 + new File([JSON.stringify(theme)], `aurora-${appearance}.json`, {
30 + type: "application/json",
31 + }),
32 + );
33 + }
34 + input.files = files.files;
35 + input.dispatchEvent(new Event("change", { bubbles: true }));
36 + return null;
37 + });
38 + await expect(dialog).toBeHidden();
39 + await screen.getByRole("button", "Use Aurora theme", { exact: true }).tap();
40 + await app.screenshot("paired-theme-custom-css");
41 + await expect
42 + .poll(() =>
43 + browser.evaluate(() => {
44 + const surface = document.querySelector("[data-settings-page-scroll]");
45 + if (!surface) throw new Error("Settings surface is missing");
46 + return getComputedStyle(surface).outlineWidth;
47 + }),
48 + )
49 + .toBe("8px");
50 + },
51 +);