@devries-cameron20 / t3code Mirror · read-only / commits / 1905846e03
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 21:45 UTC

fix(web): Dark+ and Light+ themes import instead of colliding with built-in ids (#14499)

oliver committed Sep 30, 2026 at 17:49 UTC 1905846e03226582f64fec16e1500ddffa151fdf
2 files changed +40 -3
apps/web/src/vscodeThemeImport.test.ts
+30
@@ -112,6 +112,36 @@ describe("VS Code theme import", () => {
112 );
113 });
114
115 + it("moves reserved VS Code names to a non-reserved id", () => {
116 + const darkPlus = parseVsCodeThemeFile({
117 + name: "Dark+",
118 + type: "dark",
119 + colors: { "editor.background": "#1e1e1e" },
120 + });
121 + expect(darkPlus.label).toBe("Dark+");
122 + expect(darkPlus.id).not.toBe("dark");
123 + expect(darkPlus.id).toBe("dark-vscode");
124 + });
125 +
126 + it("keeps Dark+ and Light+ as separate themes instead of pairing them as +", () => {
127 + const themes = pairVsCodeThemes([
128 + parseVsCodeThemeFile({
129 + name: "Light+",
130 + type: "light",
131 + colors: { "editor.background": "#ffffff" },
132 + }),
133 + parseVsCodeThemeFile({
134 + name: "Dark+",
135 + type: "dark",
136 + colors: { "editor.background": "#1e1e1e" },
137 + }),
138 + ]);
139 + expect(themes.map((theme) => [theme.id, theme.label])).toEqual([
140 + ["light-vscode", "Light+"],
141 + ["dark-vscode", "Dark+"],
142 + ]);
143 + });
144 +
145 it("fills every role the file omits with a readable derived value", () => {
146 const theme = parseVsCodeThemeFile(VSCODE_DARK);
147 const colors = getThemeColorsForMode(theme, "dark")!;
apps/web/src/vscodeThemeImport.ts
+10 -3
@@ -1,8 +1,10 @@
1 import {
2 createVividThemeColors,
3 getThemeModes,
4 + isReservedThemeId,
5 parseThemeFile,
6 themeColorToHex,
7 + themeIdFromName,
8 THEME_FILE_VERSION,
9 type ThemeAppearance,
10 type ThemeColorRole,
@@ -321,9 +323,12 @@ export function parseVsCodeThemeFile(value: unknown): ThemeDefinition {
323
324 // Reuse the theme-file parser so ids, names, and color values go through the
325 // same validation as a hand-written file.
326 + const name = resolveName(value);
327 + const generatedId = themeIdFromName(name);
328 return parseThemeFile({
329 version: THEME_FILE_VERSION,
326 - name: resolveName(value),
330 + ...(isReservedThemeId(generatedId) ? { id: `${generatedId}-vscode` } : {}),
331 + name,
332 appearance,
333 colors: { ...derived, ...overrides },
334 });
@@ -352,9 +357,11 @@ export function pairVsCodeThemes(
357 const passthrough: Array<{ theme: ThemeDefinition; order: number }> = [];
358 themes.forEach((theme, order) => {
359 // Only single-appearance themes with an appearance word in the name can
355 - // pair; anything else is already what the user asked for.
360 + // pair, and only when the rest of the name can still identify the pair
361 + // ("Dark+" and "Light+" would pair as "+"); anything else is already
362 + // what the user asked for.
363 const key = stripAppearance(theme.label);
357 - if (getThemeModes(theme).length !== 1 || key === theme.label || key.length === 0) {
364 + if (getThemeModes(theme).length !== 1 || key === theme.label || !/[a-z0-9]/i.test(key)) {
365 passthrough.push({ theme, order });
366 return;
367 }