Skip to content

VSCode theme support in T3 Code#2550

Open
bmdavis419 wants to merge 5 commits intomainfrom
t3code/vscode-theme-plan
Open

VSCode theme support in T3 Code#2550
bmdavis419 wants to merge 5 commits intomainfrom
t3code/vscode-theme-plan

Conversation

@bmdavis419
Copy link
Copy Markdown

@bmdavis419 bmdavis419 commented May 6, 2026

auto-detects vscode/cursor themes installed on ur machine. u pick one, it just works in t3 code

image image

enjoy the 5.5 xHigh slop pr, do with it what u will I just want this to exist at some point in some way

Summary

  • Add desktop-side discovery and loading for VS Code and Cursor color themes, including safe path resolution and JSONC settings parsing.
  • Extend the desktop bridge and contracts so the web app can refresh, select, and apply external themes.
  • Update web theme handling so syntax highlighting, diffs, terminal colors, and app CSS can respond to resolved editor themes.
  • Add tests for theme discovery, theme resolution, shared theme mapping, and client settings persistence.

Testing

  • bun fmt
  • bun lint
  • bun typecheck
  • Not run: bun run test

Note

Add VSCode/Cursor color theme support to the T3 Code desktop app

  • Adds a vscodeThemeDiscovery module to the desktop app that scans VS Code, VS Code Insiders, and Cursor extension directories, reads editor settings, and resolves full color themes including workbench and token colors.
  • Exposes four new IPC channels (desktop:discover-color-themes, desktop:load-color-theme, desktop:get-editor-theme-preferences, desktop:set-window-theme-colors) and corresponding desktopBridge methods to the renderer.
  • Overhauls useTheme to support a richer ThemePreference model with system, builtin, external, and follow-editor modes; external themes are loaded async with loading/error states and a bootstrap cache to prevent flash on cold start.
  • Registers resolved external themes with the Shiki/diffs highlighter via a new syntaxTheme library, making code block and diff syntax highlighting follow the active editor theme.
  • Updates the General Settings theme selector to list discovered external themes grouped by source (VS Code, Cursor) with a refresh button.
  • Adds new CSS variables for sidebar, terminal, diff, and chat-request colors in index.css, and makes terminal colors follow those variables.
  • Behavioral Change: themePreference is now persisted in ClientSettings and localStorage; existing light/dark/system values are migrated automatically to the new schema.

Macroscope summarized 4e4f44f.

bmdavis419 added 2 commits May 6, 2026 01:09
- Document discovery, mapping, and persistence strategy
- Outline desktop bridge, settings UI, and rollout phases
- Discover editor themes from desktop installs
- Map theme colors into shared app and syntax tokens
- Wire theme state through desktop, web, and settings
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ba7a507e-0296-4975-8e93-e71f005d4b80

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/vscode-theme-plan

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 6, 2026
@bmdavis419 bmdavis419 changed the title Add VS Code theme discovery and app theming VSCode theme support in T3 Code May 6, 2026
Comment thread packages/shared/src/themeMapping.ts Outdated
Comment thread apps/web/src/hooks/useTheme.ts
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 6, 2026

Approvability

Verdict: Needs human review

2 blocking correctness issues found. This PR introduces a substantial new feature (VSCode/Cursor theme integration) with ~800 lines of new code, new IPC channels, significant state management changes in the theme hook, and runtime behavior changes across multiple components. Additionally, unresolved review comments identify potential bugs where the UI could become stuck in a loading state.

You can customize Macroscope's approvability policy. Learn more.

- Reset stored theme preference when the requested VS Code theme cannot be loaded
- Reuse the resolved destructive color for both destructive and destructive-foreground mapping
Comment thread apps/web/src/hooks/useTheme.ts
- Add preference equality guard in theme hook
- Prevent outdated async theme loads from overriding newer selections
Comment thread apps/web/src/hooks/useTheme.ts
Comment on lines +315 to +320
localStorage.setItem(
BOOTSTRAP_THEME_CACHE_KEY,
JSON.stringify({ id: theme.id, kind: theme.kind, appVariables: theme.appVariables }),
);
recomputeSnapshot({ preference, resolvedColorTheme: theme, status: "ready", message: null });
applyResolvedTheme(theme, suppressTransitions);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium hooks/useTheme.ts:315

If localStorage.setItem on line 315 throws (e.g., QuotaExceededError or SecurityError in private browsing), the exception propagates unhandled. This prevents recomputeSnapshot and applyResolvedTheme on lines 319-320 from executing, leaving the state stuck at status: "loading" while the successfully loaded theme is never applied.

-    localStorage.setItem(
-      BOOTSTRAP_THEME_CACHE_KEY,
-      JSON.stringify({ id: theme.id, kind: theme.kind, appVariables: theme.appVariables }),
-    );
-    recomputeSnapshot({ preference, resolvedColorTheme: theme, status: "ready", message: null });
-    applyResolvedTheme(theme, suppressTransitions);
+    try {
+      localStorage.setItem(
+        BOOTSTRAP_THEME_CACHE_KEY,
+        JSON.stringify({ id: theme.id, kind: theme.kind, appVariables: theme.appVariables }),
+      );
+    } catch {
+      // Cache failure should not block theme application
+    }
+    recomputeSnapshot({ preference, resolvedColorTheme: theme, status: "ready", message: null });
+    applyResolvedTheme(theme, suppressTransitions);
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/web/src/hooks/useTheme.ts around lines 315-320:

If `localStorage.setItem` on line 315 throws (e.g., `QuotaExceededError` or `SecurityError` in private browsing), the exception propagates unhandled. This prevents `recomputeSnapshot` and `applyResolvedTheme` on lines 319-320 from executing, leaving the state stuck at `status: "loading"` while the successfully loaded `theme` is never applied.

Evidence trail:
apps/web/src/hooks/useTheme.ts lines 275-322 (REVIEWED_COMMIT): `loadPreference` function. Line 290 sets status to 'loading'. try/catch on lines 291-301 only wraps `bridge.loadColorTheme`. Line 315-318 `localStorage.setItem(BOOTSTRAP_THEME_CACHE_KEY, ...)` is outside try/catch. Lines 319-320 set 'ready' status and apply theme. Callers at lines 392, 409, 421 all use `void loadPreference(...)` (fire-and-forget).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant