Skip to content

feat(terminal): match terminal color scheme to app theme automatically#3345

Merged
gregpriday merged 4 commits intodevelopfrom
feature/issue-3338-match-terminal-color-scheme
Mar 16, 2026
Merged

feat(terminal): match terminal color scheme to app theme automatically#3345
gregpriday merged 4 commits intodevelopfrom
feature/issue-3338-match-terminal-color-scheme

Conversation

@gregpriday
Copy link
Collaborator

Summary

  • Each of Canopy's twelve app themes now has a designated matching terminal color scheme. Changing the app theme automatically updates the terminal to its matched scheme when the user is on the "Match App Theme" default.
  • Added 7 new terminal color schemes to the built-in library (Gruvbox Dark, Nord, Tokyo Night, One Light, Selenized Light, Alabaster Light, Catppuccin Latte) to cover all twelve theme mappings. Each scheme includes a source comment with project name and license.
  • The automatic match only applies when the user hasn't explicitly overridden the terminal scheme. Manual picks are preserved across theme changes.

Resolves #3338

Changes

  • src/config/terminalColorSchemes.ts — added 7 new schemes with attribution comments; added APP_THEME_TERMINAL_MAP mapping each app theme ID to its designated terminal scheme
  • src/store/terminalColorSchemeStore.ts — added resolvedScheme selector that returns the designated scheme for the current app theme when the user is on "Match App Theme"; hasUserOverride flag tracks whether the user has explicitly chosen a scheme
  • src/components/Settings/ColorSchemePicker.tsx — updated picker to show the resolved scheme name alongside "Match App Theme" so users can see which palette is active
  • src/components/Terminal/XtermAdapter.tsx — uses resolvedScheme so the terminal always renders with the correct colors
  • Tests updated to cover the mapping logic, resolved scheme selector, and user override behaviour

Testing

Unit tests pass (npm run check clean at 298 warnings, 0 errors, matching the ratchet baseline). The mapping covers all 12 app themes, light themes map to light-background terminal schemes, dark themes to dark-background schemes. Override persistence was tested via the store tests.

@gregpriday
Copy link
Collaborator Author

Review status: Ready (rebase needed after #3343)

11 new terminal color schemes with proper attribution. APP_THEME_TERMINAL_SCHEME_MAP covers all 12 app themes. Light themes correctly map to light terminal schemes and vice versa. resolvedScheme pattern in ColorSchemePicker is clean. Tests thorough.

Cross-PR note: This PR conflicts with PR #3343 in terminalColorSchemeStore.ts and XtermAdapter.tsx. PR #3343 extracts computeEffectiveTheme() and adds selectEffectiveTheme, while this PR rewrites getEffectiveTheme() with app-theme mapping. After #3343 merges, rebase this PR and adapt the app-theme mapping to work with the computeEffectiveTheme() pattern.

Recommended merge order: #3343#3344#3345 (rebase first)

gregpriday and others added 4 commits March 16, 2026 16:13
- Add 10 new curated terminal color schemes: Tokyo Night, Gruvbox Dark,
  Everforest Dark, Oceanic Next, Kanagawa Dragon, Tomorrow Night,
  Rosé Pine Dawn, Catppuccin Latte, Atom One Light, Gruvbox Light,
  Ayu Light
- Add APP_THEME_TERMINAL_SCHEME_MAP mapping all 12 app themes to
  terminal schemes
- Update getEffectiveTheme() to resolve mapped scheme when "canopy"
  (Match App Theme) is selected
- Update selectWrapperBackground() to return mapped scheme background
- Add app theme subscription to useTerminalConfig hook for live updates
- Update ColorSchemePicker to dynamically preview mapped scheme colors
- Update tests for new scheme count, mapping coverage, and store behavior
- Split !scheme and scheme.id === DEFAULT_SCHEME_ID conditions in
  selectWrapperBackground and getEffectiveTheme
- Unknown scheme IDs now correctly fall back to CSS variable/CSS theme
- Fix test count from 18 to 19 built-in schemes
- Fix XtermAdapter wrapper background not updating on app theme change
  by computing it in useMemo with both store dependencies
- Add test for canopy with unmapped custom app theme (getEffectiveTheme
  and selectWrapperBackground fallback paths)
- Reset appThemeStore fully in beforeEach (customSchemes, colorVisionMode)
Use direct store subscription instead of useMemo with external deps
to trigger re-renders on app theme change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gregpriday gregpriday force-pushed the feature/issue-3338-match-terminal-color-scheme branch from f75de7d to 94a378a Compare March 16, 2026 05:15
@gregpriday gregpriday merged commit 3194bb8 into develop Mar 16, 2026
3 checks passed
@gregpriday gregpriday deleted the feature/issue-3338-match-terminal-color-scheme branch March 16, 2026 05:16
gregpriday added a commit that referenced this pull request Mar 16, 2026
- Add module-level cache to selectEffectiveTheme so it returns a stable
  object reference; was creating new objects every call causing Zustand
  to trigger infinite re-renders in XtermAdapter
- Add dedicated "daintree" built-in terminal scheme derived from the
  Daintree app theme tokens (green accent, dark canvas) to restore the
  original terminal appearance lost in PR #3345
- Map daintree → "daintree" in APP_THEME_TERMINAL_SCHEME_MAP instead of
  catppuccin-mocha
- Update tests to reflect new scheme count (20) and daintree colors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match terminal color scheme to app theme automatically

1 participant