@devries-cameron20 / t3code-1 / commits / 0222aa255d
Fork 0

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

fix(web): preserve theme when toggling advanced colors (#8500)

Wout Stiens committed Sep 2, 2026 at 00:04 UTC 0222aa255d11babd242dbe5ed0947e5fc5eaefee
1 file changed +9 -1
apps/web/src/components/settings/ThemeEditorPanel.tsx
+9 -1
@@ -308,6 +308,7 @@ export function ThemeEditorPanel({
308 const [simpleColorsDirtyByAppearance, setSimpleColorsDirtyByAppearance] = useState<
309 Record<ThemeAppearance, boolean>
310 >({ light: false, dark: false });
311 + const [shouldRegenerateGuidedColors, setShouldRegenerateGuidedColors] = useState(false);
312 const [error, setError] = useState<string | null>(null);
313 const [isMinimized, setIsMinimized] = useState(false);
314 const [roleQuery, setRoleQuery] = useState("");
@@ -401,6 +402,10 @@ export function ThemeEditorPanel({
402 // regenerate when the guided editor produced it.
403 setIsAdvanced(sourceTheme !== null && sourceTheme.managed !== true);
404 setSimpleColorsDirtyByAppearance({ light: false, dark: false });
405 + // An unmanaged palette needs conversion when the user opts into the
406 + // guided editor. Merely revealing Advanced for a managed/default draft
407 + // must stay read-only until a color changes.
408 + setShouldRegenerateGuidedColors(sourceTheme !== null && sourceTheme.managed !== true);
409 setColorsByAppearance(nextColors);
410 setSelectedRole(null);
411 setUsageCount(null);
@@ -497,6 +502,7 @@ export function ThemeEditorPanel({
502 [activeAppearance]: true,
503 }));
504 }
505 + if (isAdvanced) setShouldRegenerateGuidedColors(true);
506 },
507 [activeAppearance, isAdvanced],
508 );
@@ -735,6 +741,7 @@ export function ThemeEditorPanel({
741 if (selectedRole && !THEME_EDITOR_SIMPLE_ROLES.includes(selectedRole)) {
742 setSelectedRole(null);
743 }
744 + if (!shouldRegenerateGuidedColors) return;
745
746 // Regenerate every appearance the theme will save, not just the visible
747 // one, so the palettes shown after toggling match what gets saved.
@@ -754,8 +761,9 @@ export function ThemeEditorPanel({
761 }
762 return next;
763 });
764 + setShouldRegenerateGuidedColors(false);
765 },
758 - [activeAppearance, editingTheme, selectedRole],
766 + [activeAppearance, editingTheme, selectedRole, shouldRegenerateGuidedColors],
767 );
768
769 const handleSubmit = () => {