@devries-cameron20 / t3code-1 / commits / 9686cd9afe
Fork 0

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

feat(web): choose themes from chat with color previews (#12143)

maria committed Sep 16, 2026 at 21:38 UTC 9686cd9afe20d13fcb850199f9b9849a8276737a
7 files changed +211 -7
apps/web/src/components/CommandPalette.logic.ts
+4 -1
@@ -61,7 +61,7 @@ export function browseInputEndPaddingClass(input: {
61 export type SearchOverlayMode = "command" | "files" | "content";
62
63 export type CommandPaletteOpenIntent =
64 - | { readonly kind: "add-project" | "new-thread-in" }
64 + | { readonly kind: "add-project" | "new-thread-in" | "change-theme" }
65 | {
66 readonly kind: "search";
67 readonly query: string;
@@ -84,6 +84,7 @@ export type CommandPaletteUiAction =
84 }
85 | { readonly _tag: "OpenAddProject" }
86 | { readonly _tag: "OpenNewThreadIn" }
87 + | { readonly _tag: "OpenChangeTheme" }
88 | { readonly _tag: "ClearOpenIntent" };
89
90 export function reduceCommandPaletteUiState(
@@ -113,6 +114,8 @@ export function reduceCommandPaletteUiState(
114 return { open: true, mode: "command", openIntent: { kind: "add-project" } };
115 case "OpenNewThreadIn":
116 return { open: true, mode: "command", openIntent: { kind: "new-thread-in" } };
117 + case "OpenChangeTheme":
118 + return { open: true, mode: "command", openIntent: { kind: "change-theme" } };
119 case "ClearOpenIntent":
120 return state.openIntent ? { ...state, openIntent: null } : state;
121 }
apps/web/src/components/CommandPalette.tsx
+188 -4
@@ -48,9 +48,12 @@ import {
48 FolderPlusIcon,
49 LinkIcon,
50 MessageSquareIcon,
51 + MonitorIcon,
52 + MoonIcon,
53 PaletteIcon,
54 SettingsIcon,
55 SquarePenIcon,
56 + SunIcon,
57 TextSearchIcon,
58 } from "lucide-react";
59 import {
@@ -74,6 +77,15 @@ import { useOpenPanelPullRequestUrl } from "../hooks/useOpenPanelPullRequestUrl"
77 import { writeTextToClipboard } from "../hooks/useCopyToClipboard";
78 import { useClientSettings } from "../hooks/useSettings";
79 import { useTheme } from "../hooks/useTheme";
80 +import { useCustomThemes } from "../hooks/useCustomThemes";
81 +import { useEnvironmentThemeDefinitions } from "../hooks/useEnvironmentTheme";
82 +import { BUILT_IN_THEMES } from "@t3tools/shared/themePalettes";
83 +import { getThemeDefinition } from "../themePalette";
84 +import {
85 + STANDARD_THEME_CARDS,
86 + getThemeCardDefinition,
87 + ThemePreviewCircle,
88 +} from "./settings/ThemePreviewCircles";
89 import { readLocalApi } from "../localApi";
90 import { desktopLocalBackendId } from "../connection/desktopLocal";
91 import { filesystemEnvironment } from "../state/filesystem";
@@ -184,6 +196,22 @@ import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons";
196
197 const EMPTY_BROWSE_ENTRIES: FilesystemBrowseResult["entries"] = [];
198
199 +const APPEARANCE_OPTIONS = [
200 + { mode: "system", label: "System", icon: MonitorIcon },
201 + { mode: "light", label: "Light", icon: SunIcon },
202 + { mode: "dark", label: "Dark", icon: MoonIcon },
203 +] as const;
204 +
205 +function notifyThemeSaveFailure(): void {
206 + toastManager.add(
207 + stackedThreadToast({
208 + type: "error",
209 + title: "Couldn't save theme selection",
210 + description: "Try again.",
211 + }),
212 + );
213 +}
214 +
215 function projectFavicon(project: Project) {
216 return <ProjectFavicon project={project} className="size-4" />;
217 }
@@ -453,7 +481,7 @@ export function CommandPalette({ children }: { children: ReactNode }) {
481 const openNewThreadIn = useCallback(() => dispatch({ _tag: "OpenNewThreadIn" }), []);
482 const clearOpenIntent = useCallback(() => dispatch({ _tag: "ClearOpenIntent" }), []);
483 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
456 - const { theme, themeHalves, resolvedTheme } = useTheme();
484 + const { theme, themeHalves, resolvedTheme, appearanceMode, setAppearanceMode } = useTheme();
485 const composerHandleRef = useRef<ChatComposerHandle | null>(null);
486 const routeTarget = useParams({
487 strict: false,
@@ -494,8 +522,33 @@ export function CommandPalette({ children }: { children: ReactNode }) {
522 terminalOpen,
523 previewFocus: isPreviewFocused(),
524 previewOpen,
525 + modelPickerOpen: composerHandleRef.current?.isModelPickerOpen() ?? false,
526 },
527 });
528 + if (command === "appearance.cycle") {
529 + event.preventDefault();
530 + event.stopPropagation();
531 + if (event.repeat) return;
532 + const nextMode =
533 + appearanceMode === "system" ? "light" : appearanceMode === "light" ? "dark" : "system";
534 + if (!setAppearanceMode(nextMode)) {
535 + notifyThemeSaveFailure();
536 + } else {
537 + toastManager.add({
538 + id: "appearance-cycle",
539 + title: `Appearance: ${APPEARANCE_OPTIONS.find((option) => option.mode === nextMode)?.label}`,
540 + timeout: 1500,
541 + });
542 + }
543 + return;
544 + }
545 + if (command === "theme.select") {
546 + event.preventDefault();
547 + event.stopPropagation();
548 + if (event.repeat) return;
549 + dispatch({ _tag: "OpenChangeTheme" });
550 + return;
551 + }
552 if (command === "themeEditor.toggle") {
553 event.preventDefault();
554 event.stopPropagation();
@@ -516,7 +569,17 @@ export function CommandPalette({ children }: { children: ReactNode }) {
569 };
570 window.addEventListener("keydown", onKeyDown);
571 return () => window.removeEventListener("keydown", onKeyDown);
519 - }, [keybindings, previewOpen, resolvedTheme, terminalOpen, theme, themeHalves, toggleMode]);
572 + }, [
573 + appearanceMode,
574 + keybindings,
575 + previewOpen,
576 + resolvedTheme,
577 + setAppearanceMode,
578 + terminalOpen,
579 + theme,
580 + themeHalves,
581 + toggleMode,
582 + ]);
583
584 useEffect(
585 () =>
@@ -702,7 +765,30 @@ function OpenCommandPaletteDialog(props: {
765 const projectOrder = useUiStateStore((store) => store.projectOrder);
766 const threads = useThreadShells();
767 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
705 - const { theme, themeHalves, resolvedTheme } = useTheme();
768 + const {
769 + theme,
770 + themeHalves,
771 + resolvedTheme,
772 + appearanceMode,
773 + setAppearanceMode,
774 + setTheme,
775 + setThemeHalf,
776 + } = useTheme();
777 + const customThemes = useCustomThemes();
778 + const environmentThemes = useEnvironmentThemeDefinitions();
779 + const themeCards = useMemo(() => {
780 + const seen = new Set<string>();
781 + return [
782 + ...STANDARD_THEME_CARDS.map((card) => ({ ...card, id: null })),
783 + ...[...BUILT_IN_THEMES, ...customThemes, ...environmentThemes]
784 + .filter((definition) => {
785 + if (seen.has(definition.id)) return false;
786 + seen.add(definition.id);
787 + return true;
788 + })
789 + .map(getThemeCardDefinition),
790 + ];
791 + }, [customThemes, environmentThemes]);
792 const providers = useAtomValue(primaryServerProvidersAtom);
793 const providerEntryByEnvironmentAndInstanceId = useMemo(() => {
794 const map = new Map<string, ProviderInstanceEntry>();
@@ -1803,6 +1889,100 @@ function OpenCommandPaletteDialog(props: {
1889 });
1890 }
1891
1892 + const changeThemeItem: CommandPaletteSubmenuItem = {
1893 + kind: "submenu",
1894 + value: "action:change-theme",
1895 + searchTerms: ["change theme", "appearance", "colors", "palette"],
1896 + title: "Change theme",
1897 + icon: <PaletteIcon className={ITEM_ICON_CLASS} />,
1898 + addonIcon: <PaletteIcon className={ADDON_ICON_CLASS} />,
1899 + shortcutCommand: "theme.select",
1900 + groups: [
1901 + {
1902 + value: "themes",
1903 + label: "Change theme",
1904 + items: themeCards.map(({ id, label, previews }) => ({
1905 + kind: "action",
1906 + value: id === null ? "theme:standard" : `theme:palette:${id}`,
1907 + title: label,
1908 + description: previews.length === 1 ? `For ${previews[0]!.mode} mode` : undefined,
1909 + searchTerms: [label, "theme", "appearance"],
1910 + icon: <PaletteIcon className={ITEM_ICON_CLASS} />,
1911 + titleTrailingContent: (
1912 + <span className="flex shrink-0 items-center gap-2">
1913 + {(themeHalves?.[resolvedTheme] ?? getThemeDefinition(theme)?.id ?? null) === id ? (
1914 + <span className="text-xs text-muted-foreground/70">Current</span>
1915 + ) : null}
1916 + <span className="flex items-center gap-1" aria-hidden>
1917 + {previews.map((preview) => (
1918 + <ThemePreviewCircle
1919 + key={preview.mode}
1920 + colors={preview.colors}
1921 + mode={preview.mode}
1922 + className="size-3 border-0"
1923 + />
1924 + ))}
1925 + </span>
1926 + </span>
1927 + ),
1928 + run: async () => {
1929 + const saved =
1930 + previews.length === 1 && id !== null
1931 + ? setThemeHalf(previews[0]!.mode, id)
1932 + : setTheme(id ?? appearanceMode);
1933 + if (!saved) notifyThemeSaveFailure();
1934 + },
1935 + })),
1936 + },
1937 + ],
1938 + };
1939 + actionItems.push(changeThemeItem);
1940 +
1941 + const changeAppearanceItem: CommandPaletteSubmenuItem = {
1942 + kind: "submenu",
1943 + value: "action:change-appearance",
1944 + searchTerms: ["change appearance", "light", "dark", "system", "mode", "toggle"],
1945 + title: "Change appearance",
1946 + icon: <MonitorIcon className={ITEM_ICON_CLASS} />,
1947 + addonIcon: <MonitorIcon className={ADDON_ICON_CLASS} />,
1948 + shortcutCommand: "appearance.cycle",
1949 + groups: [
1950 + {
1951 + value: "appearance",
1952 + label: "Change appearance",
1953 + items: APPEARANCE_OPTIONS.map(({ mode, label, icon: Icon }) => ({
1954 + kind: "action",
1955 + value: `appearance:${mode}`,
1956 + title: label,
1957 + searchTerms: [label, "appearance", "mode"],
1958 + icon: <Icon className={ITEM_ICON_CLASS} />,
1959 + titleTrailingContent:
1960 + appearanceMode === mode ? (
1961 + <span className="text-xs text-muted-foreground/70">Current</span>
1962 + ) : undefined,
1963 + run: async () => {
1964 + if (!setAppearanceMode(mode)) notifyThemeSaveFailure();
1965 + },
1966 + })),
1967 + },
1968 + ],
1969 + };
1970 + actionItems.push(changeAppearanceItem);
1971 +
1972 + useLayoutEffect(() => {
1973 + if (openIntent?.kind !== "change-theme") return;
1974 + clearOpenIntent();
1975 + browseNavigation.invalidate();
1976 + cloneLookupGeneration.current += 1;
1977 + setIsRemoteProjectLookingUp(false);
1978 + setAddProjectCloneFlow(null);
1979 + setViewStack([]);
1980 + pushPaletteView({
1981 + addonIcon: <PaletteIcon className={ADDON_ICON_CLASS} />,
1982 + groups: [{ value: "themes", label: "Change theme", items: [] }],
1983 + });
1984 + }, [browseNavigation, clearOpenIntent, openIntent, pushPaletteView]);
1985 +
1986 actionItems.push({
1987 kind: "action",
1988 value: "action:theme-editor",
@@ -1898,7 +2078,11 @@ function OpenCommandPaletteDialog(props: {
2078 addProjectEnvironmentId,
2079 buildAddProjectRemoteSourceReadiness(sourceControlDiscovery.data),
2080 )
1901 - : (currentView?.groups ?? rootGroups);
2081 + : currentView?.groups[0]?.value === "themes"
2082 + ? changeThemeItem.groups
2083 + : currentView?.groups[0]?.value === "appearance"
2084 + ? changeAppearanceItem.groups
2085 + : (currentView?.groups ?? rootGroups);
2086
2087 const filteredGroups = filterCommandPaletteGroups({
2088 activeGroups,
apps/web/src/components/settings/ThemePreviewCircles.tsx
+6 -1
@@ -131,14 +131,19 @@ function themePreviewEdgeShadow(mode: ThemeAppearance): string {
131 export function ThemePreviewCircle({
132 colors,
133 mode,
134 + className,
135 }: {
136 colors: ThemeCardPreviewColors;
137 mode: ThemeAppearance;
138 + className?: string;
139 }) {
140 return (
141 <span
142 aria-hidden
141 - className="relative block size-14 shrink-0 overflow-hidden rounded-full border-2 border-background"
143 + className={cn(
144 + "relative block size-14 shrink-0 overflow-hidden rounded-full border-2 border-background",
145 + className,
146 + )}
147 style={{ boxShadow: themePreviewEdgeShadow(mode) }}
148 >
149 <span
apps/web/src/themePalette.ts
+3 -1
@@ -238,9 +238,11 @@ export function invalidateCustomThemes() {
238 notifyCustomThemeListeners();
239 }
240
241 +const EMPTY_CUSTOM_THEMES: ReadonlyArray<ThemeDefinition> = [];
242 +
243 export function getCustomThemes(): ReadonlyArray<ThemeDefinition> {
244 const snapshot = getCustomThemeLibrarySnapshot();
243 - return snapshot.status === "ready" ? snapshot.themes : [];
245 + return snapshot.status === "ready" ? snapshot.themes : EMPTY_CUSTOM_THEMES;
246 }
247
248 export function getEnvironmentThemes(): ReadonlyArray<ThemeDefinition> {
docs/user/appearance.md
+6
@@ -4,6 +4,12 @@ Open **Settings → Appearance** to choose a theme and follow the system appeara
4 or dark mode. To use different themes for light and dark mode, select the corresponding preview
5 within each theme. Appearance preferences are saved separately on each device or browser.
6
7 +On web and desktop, use **Change theme** in the command palette to select a theme without leaving chat.
8 +Press **Cmd+Option+A** on macOS or **Ctrl+Alt+A** on Windows/Linux to open the theme picker directly.
9 +Use **Change appearance** in the command palette to choose System, Light, or Dark independently of
10 +the theme. **Cmd+Option+Shift+A** on macOS or **Ctrl+Alt+Shift+A** on Windows/Linux cycles through
11 +those modes. Customize these shortcuts under **Settings → Keybindings**.
12 +
13 Mobile has its own themes and text, code, and terminal preferences. It does not follow environment
14 themes or defaults.
15
packages/contracts/src/keybindings.ts
+2
@@ -75,6 +75,8 @@ export const STATIC_KEYBINDING_COMMANDS = [
75 "commandPalette.toggle",
76 "filePicker.toggle",
77 "projectSearch.toggle",
78 + "theme.select",
79 + "appearance.cycle",
80 "themeEditor.toggle",
81 "composer.stash",
82 "composer.host",
packages/shared/src/keybindings.ts
+2
@@ -38,6 +38,8 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
38 { key: "mod+k", command: "commandPalette.toggle", when: "!terminalFocus" },
39 { key: "mod+p", command: "filePicker.toggle", when: "!terminalFocus" },
40 { key: "mod+shift+f", command: "projectSearch.toggle", when: "!terminalFocus" },
41 + { key: "mod+alt+a", command: "theme.select", when: "!terminalFocus" },
42 + { key: "mod+alt+shift+a", command: "appearance.cycle", when: "!terminalFocus" },
43 { key: "mod+alt+shift+t", command: "themeEditor.toggle" },
44 { key: "mod+s", command: "composer.stash", when: "!terminalFocus" },
45 { key: "mod+shift+enter", command: "thread.steerQueuedMessage", when: "!terminalFocus" },