Skip to content

feat: in-house theme system (bundled catalog, live re-apply, hover preview) - #1

Merged
rsml merged 13 commits into
masterfrom
worktree-theme-system
May 19, 2026
Merged

rsml merged 13 commits into
masterfrom
worktree-theme-system

Conversation

@rsml

@rsml rsml commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

Forge now owns its theme catalog end-to-end. No more dependency on a Ghostty install, the theme picker actually repaints terminals when you change it, and you can preview themes by hovering.

  • Bundled catalog — 31 curated themes vendored from mbadolato/iTerm2-Color-Schemes at a pinned commit. Imported via scripts/import-themes.sh (re-runnable, SHA-verified, attribution headers prepended). Resources/themes/*.conf bundled into the .app via the Makefile.
  • Path repointing — ThemeParser searches ~/.config/forge/themes/ (user override, first) → bundled themes → SPM fallback. Ghostty paths dropped entirely.
  • Live re-apply — applyGhosttyTheme(overrideTheme:) helper in AppDelegate; .forgeConfigChanged observer calls it so picking a theme repaints existing panes immediately (was a known bug — applyConfig was only called once at launch).
  • File watcher — ThemeWatcher (DispatchSource.makeFileSystemObjectSource) watches ~/.config/forge/themes/; dropping a .conf there shows up in the picker without restart.
  • Hover preview — ThemePreviewCard.onHover posts a transient theme, observers in AppDelegate apply it to libghostty without touching ForgeConfigStore. Mouse-out and pane disappear revert.
  • Attribution — docs/THEMES.md credits the upstream catalog and per-theme authors; About pane gets a "Theme Acknowledgments" link.
  • ADR 0005 documents the Ghostty-format compatibility decision.

Plan: docs/superpowers/plans/2026-05-18-in-house-theme-system.md.

Breaking change

Existing users whose saved config references "ghostty-seti" (the previous default) will land on the no-theme fallback colors until they reselect a theme. This is documented as accepted UX in the plan. loadTheme now logs the unresolved id so the situation is diagnosable.

Test plan

swift test passes (142 tests, 14 suites). The rest requires make dev + manual interaction:

  • Open Settings → Theme — grid shows ~31 themes
  • Pick a theme — terminal panes repaint immediately
  • Pick a light theme (Catppuccin Latte / GitHub Light Default) — verify light variant works
  • Hover a different theme card — terminal previews, mouse-out reverts
  • Close Settings while hovering a card — reverts to selected theme
  • mkdir -p ~/.config/forge/themes && cp Resources/themes/Dracula.conf ~/.config/forge/themes/MyTheme.conf — appears in picker without restart
  • About → "Theme Acknowledgments" opens the docs URL
  • grep -r "ghostty/themes" Sources/ returns no hits (Ghostty path references are gone)

🤖 Generated with Claude Code

rsml and others added 13 commits May 18, 2026 22:40
Curated catalog from iTerm2-Color-Schemes (~30 themes), bundle-resolved
paths, live re-apply on settings change, file watcher for user overrides,
and hover-to-preview in the picker.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replace Ghostty app/config search paths with: user override (~/.config/forge/themes, first),
bundled themes (Bundle.main.resourceURL + SPM fallback). Strip .conf extension before
deriving display names. Update default theme to Seti.conf.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Log once when loadTheme(id:) finds no matching file for a non-empty id, so
saved configs referencing missing themes are diagnosable. Use Self.searchPaths
in loadTheme to match the style already used in loadAllThemes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Extract applyGhosttyTheme() helper on AppDelegate (with overrideTheme param for Task 7 hover preview), replace inline launch-time block, and subscribe to .forgeConfigChanged so theme/font changes in Settings take effect immediately.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add docs/THEMES.md with full attribution table for all bundled themes (sourced from mbadolato/iTerm2-Color-Schemes), trademark notes, and a reporting-issues link. Add a secondary "Theme Acknowledgments" link button to the About pane that opens the doc on GitHub.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ThemeWatcher uses DispatchSource/O_EVTONLY to watch the user themes
directory and posts .forgeThemesChanged; ThemeSettingsPane reloads
on that notification so dropped theme files appear without reopening
Settings.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Post forgeThemeHoverPreview / forgeThemeHoverEnded notifications from
ThemePreviewCard; AppDelegate observers call applyGhosttyTheme with the
hovered theme or revert to configured theme. Pane disappear cleans up.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
make test    — swift test
make restart — kill running Forge then make dev
make logs    — tail -f /tmp/forge.log

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@rsml
rsml merged commit 3fec459 into master May 19, 2026
@rsml
rsml deleted the worktree-theme-system branch May 19, 2026 15:14
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