feat(web): add modular theme library - #5226
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds semantic theme roles, persisted light and dark variants, personal theme import and creation, contrast-safe surfaces, and themed message actions. Includes the T3 Chat palette, follow-system behavior, splash handling, and the theme library UI.
e0f79e4 to
607dd6b
Compare
ApprovabilityVerdict: Needs human review This PR introduces a complete modular theme library with new user-facing workflows for creating, editing, and importing custom themes. The 4100+ line addition includes new UI components, storage patterns, boot script changes, and a CSS variable architecture. New features of this scope warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Full review pass over the modular theme system: - Rewrite the index.html boot script to mirror runtime resolution exactly: clamp built-in themes to their available modes (T3 Chat is light-only), treat unrecognized preferences as the system default, follow the OS in the storage-failure fallback, and honor corrupted follow-system values the same way the runtime does. Add a boot/runtime parity test that evaluates the inline script against resolveThemeAppearance. - Keep the color picker's hue when a grey/white/black echo round-trips, open hand-tuned themes in advanced mode so guided regeneration cannot silently discard their palettes, and regenerate every saved appearance when toggling Advanced off. - Cache the useTheme snapshot instead of reading localStorage on every consumer render, and share one storage/matchMedia listener pair. - Restore hover and emphasis states lost in the token migration (message action hover, provider update pill, sidebar read/unread, plan-mode toggle) and fix message-foreground tokens used on background surfaces. - Extract the theme library/editor into ThemeSettings.tsx, memoize the color rows, reuse the Alert component and shared isThemeColor, drop the dead StageBackdropButtonArt and themePreferenceForSystem, and make stored-theme parsing tolerant of unknown roles from other builds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a096aba. Configure here.
- The boot script no longer follows the OS for a `:system`-suffixed preference when follow-system is explicitly off, matching the runtime; covered by two new parity cases. - setTheme/setFollowSystem report write success, so the follow-system toggle leaves the theme preference untouched when its write fails, and removing the active theme keeps it installed when the selection cannot be moved off it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The document ships light-media, dark-media, and plain theme-color metas; the browser reads whichever matches the OS, so mutating only the first element left themed chrome colors unapplied on a dark OS. Both the boot script and syncBrowserChromeTheme now write the resolved color to every matching meta. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Swap the light palette to t3.chat's actual tokens — #a84370 primary, #db2777 ring, #501854 foreground, #faf5fa background, and its pink surface family — for the deeper pink accents of the product. The boot splash and managed-editor fallbacks follow, and a contrast guard test keeps the key pairings readable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Summary
T3 Code now has a token-based theme foundation that can grow from maintainer themes into user-created themes across the web client and desktop app.
Closes #418
Screenshots
The library views show the maintainer themes alongside personal-theme cards.
Verification
Note
Add modular theme library with custom themes, follow-system support, and semantic design tokens
themePalette.tswith a full theme system: built-in themes (T3 Chat, T3 Grove), custom theme parsing/serialization, variant support, and contrast validation.index.htmlto resolve and apply themes before first paint, settingdata-theme-id/data-theme-selectedon the root element, CSS boot variables, andmeta[name="theme-color"].ThemeLibraryUI in the Appearance settings panel (replacing a simple dropdown), backed by a newThemeSettings.tsxmodule with theme card and editor helpers.useTheme.tswith explicitfollowSystemstate,setFollowSystem/refreshThemeAPI, palette application viaapplyThemePalette, snapshot caching, and cross-tab storage sync for custom themes.index.css(--message-*,--code-*,--terminal-*,--error-*,--warning-*,--update-*,--placeholder,--secondary-label,--icon-muted) and migrates all components from opacity-modulatedmuted-foregroundclasses to these named tokens.ThreadTerminalDrawer.tsxnow reads theme CSS variables for background, foreground, cursor, and selection.localStoragestructure — malformed or missing keys fall back to OS preference.Macroscope summarized f52a34c.
Note
Medium Risk
Large cross-app UI refactor plus synchronous boot-time localStorage parsing; behavior changes on theme storage failure and many visual surfaces, but no auth or data-handling logic.
Overview
Adds a token-based theming system with maintainer themes (Default, T3 Chat, T3 Grove), personal themes in localStorage, and a Follow system preference separate from the stored theme id.
Appearance settings swaps the light/dark/system dropdown for a theme library (select, create, edit, import/export JSON, delete) with guided (canvas + accent) and advanced color editors.
Boot script in
index.htmlnow mirrors runtime theme resolution—custom themes,t3-chat/t3-grove, legacyt3-chat-dark, follow-system, splash--boot-*variables, and OS fallback on storage errors (replacing the previous always-dark catch).useThemeapplies palettes viaapplyThemePalette, syncst3code:theme-follow-system, listens for custom-theme storage changes, and exposessetFollowSystem/refreshTheme;setThemereturns success/failure.Across the UI, hard-coded opacity grays and ad-hoc blues/ambers are replaced with semantic classes (
text-secondary-label,text-icon-muted,text-placeholder,bg-message,bg-message-action,text-error,text-warning,text-update,--code-background,--terminal-*). Composer send actions use message-action tokens instead of primary/stage-backdrop artwork on the send button.Diff panels, file previews, and the terminal drawer read code/terminal CSS variables so themed palettes affect those surfaces.
Reviewed by Cursor Bugbot for commit f52a34c. Bugbot is set up for automated code reviews on this repo. Configure here.