Skip to content

feat(web): add selectable diff syntax theme in settings - #5

Merged
enisze merged 1 commit into
mainfrom
feat/diff-syntax-theme
Jul 29, 2026
Merged

feat(web): add selectable diff syntax theme in settings#5
enisze merged 1 commit into
mainfrom
feat/diff-syntax-theme

Conversation

@enisze

@enisze enisze commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a Diff theme dropdown to Settings → Appearance so the syntax highlighting theme for code diffs is user-configurable, instead of being hardcoded to pierre-dark.

Themes come from the set already bundled by @pierre/diffs (Pierre + Shiki collections), so there's no new dependency. The selected theme applies in dark mode; light mode continues to use pierre-light. Changing it updates open diffs live.

Changes

  • contracts: new diffTheme client setting (DiffTheme schema, pierre-dark default) added to ClientSettingsSchema + ClientSettingsPatch; wired into the "Restore defaults" flow.
  • resolveDiffThemeName(resolvedTheme, darkTheme): maps dark mode → selected theme, light mode → pierre-light. Adds DIFF_THEME_OPTIONS (dropdown list) and DIFF_HIGHLIGHTER_THEME_NAMES (registered up front so runtime switching never hits an unattached theme).
  • useDiffThemeName hook: combines app light/dark mode + the setting; used by DiffPanel, ChatMarkdown, DiffWorkerPoolProvider, MessagesTimeline, and FilePreviewPanel so they react to the setting.
  • Settings UI: the dropdown (15 curated themes: Pierre Dark, Tokyo Night, One Dark Pro, Ayu Dark, Dracula, Catppuccin Mocha, GitHub Dark/Dimmed, Material Palenight, Night Owl, Nord, Monokai, Poimandres, Vesper, SynthWave '84).

Notes

  • Default stays pierre-dark (no behavior change out of the box).
  • Verified against @pierre/diffs source that themes resolve on the main thread before being sent to the worker, so runtime switching works for all listed themes.

🤖 Generated with Claude Code

Add a "Diff theme" dropdown to Settings → Appearance that lets users
choose the syntax highlighting theme for code diffs from a curated set
of themes bundled by @pierre/diffs (Pierre + Shiki collections).

- New `diffTheme` client setting (contracts) with `pierre-dark` default,
  persisted and synced like other client settings and wired into the
  "Restore defaults" flow.
- `resolveDiffThemeName` now maps dark mode to the selected theme and
  light mode to pierre-light; a `useDiffThemeName` hook makes every diff
  surface (DiffPanel, ChatMarkdown, worker pool, timeline, file preview)
  react live to the setting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@enisze
enisze merged commit 3396b19 into main Jul 29, 2026
@enisze
enisze deleted the feat/diff-syntax-theme branch July 29, 2026 21:59
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.

1 participant