Skip to content

theme(M2): walking skeleton — Appearance section with 2 presets + live preview - #2

Closed
matt-ramotar wants to merge 1 commit into
theme/m1-foundationfrom
theme/m2-walking-skeleton
Closed

matt-ramotar wants to merge 1 commit into
theme/m1-foundationfrom
theme/m2-walking-skeleton

Conversation

@matt-ramotar

Copy link
Copy Markdown
Owner

PR 2/8 of the Superghost Theme System stack. Stacked on top of #1.

Summary

  • New AppearanceSection SwiftUI view inserted into SettingsView between the App card and the Workspace Colors header.
  • Live preview region (mini-sidebar + mini-terminal) painted from theme.tokens.* so a preset switch recolors both stripes in one render frame.
  • BuiltInThemes.tokyoNight and BuiltInThemes.catppuccinLatte curated presets, fully hand-specified (not derived).
  • Preset strip with click-to-apply that propagates through the cache + UserDefaults bridge.

Drift from plan

  • None notable. Walking skeleton matches the plan's M2 acceptance.

Test plan

  • xcodebuild -scheme cmux build succeeds.
  • xcodebuild -scheme cmux-unit build-for-testing succeeds.
  • Manual: open Settings → Appearance, click the two preset cards, confirm both the live preview and the real app sidebar recolor in the same render frame.

Stack

Base: #1 (M1 foundation). Continues in #3 (M3 persistence).

🤖 Generated with Claude Code

…ve preview

Second milestone of the Superghost theme system rebuild
(plans/gleaming-wobbling-rainbow.md M2). Proves the architecture
end-to-end: pick a preset in Settings → mini-preview AND the actual
app sidebar recolor in the same render frame.

What this adds:
- `Sources/AppearanceSection.swift` — the new Settings section.
  Reads from `ThemeStore` via `@EnvironmentObject`; renders the panel
  header, a miniature Superghost layout (sidebar + terminal stripes
  painted with `theme.tokens`), and a horizontal preset strip.
- `Sources/BuiltInThemes.swift` — Tokyo Night (dark) and Catppuccin
  Latte (light), both fully specified (chrome tokens hand-chosen, not
  derived). Includes a small registry API (`all`, `preset(withId:)`,
  `defaultPreset(for:)`) that M4 grows.
- `SettingsNavigationTarget.appearance` for deep-linking to the
  section. `SettingsRootView` now injects `ThemeStore.shared` as an
  environment object so the whole Settings tree can observe it.
- `AppearanceSection()` inserted in `SettingsView.body` between the
  "App" card and "Workspace Colors" header — chosen position keeps the
  legacy "Sidebar Appearance" section visible for now (M3 absorbs it).
- `ThemeStore.applyTheme(_:)` now also writes `sidebarTintHex` /
  `sidebarTintHexDark` / `sidebarTintHexLight` so existing
  `SidebarBackdrop` (`@AppStorage`-driven) reacts to preset switches
  without a restart. This is the bridge until M5 swaps those readers
  to read from `ThemeStore` directly; the legacy keys stay frozen per
  plan §2.5.
- Three new tests: preset → cardSurface lands in legacy
  `sidebarTintHex`; applying a light theme doesn't clobber the dark
  per-mode key; every shipped curated theme clears AA contrast for
  `inkBody` on `cardSurface`.

Drift called out:
- The plan's M2 acceptance asks for "two existing chrome surfaces"
  (sidebar + TabItemView accent). Only the sidebar is wired this
  milestone; the accent is left for M5 (chrome migration) where it
  belongs with the rest of the literal-replacement work — wiring it
  through a bespoke UserDefaults bridge now would be throwaway code.
- The plan's M2 test ("ContentView::sidebarBackgroundForActiveTheme()
  returns #1a1b26") references a function that doesn't exist today.
  We test the observable bridge instead: `sidebarTintHex` equals the
  expected hex after `applyTheme(.tokyoNight)`. Same intent, tested
  against real behavior.
- Tokyo Night's `inkCaption` shipped at #737aa2 from the start (plan
  defers the bump to M6 for R1). Doing it early so the walking
  skeleton already meets AA on captions.

Build verified: `xcodebuild ... -scheme cmux` (BUILD SUCCEEDED) and
`xcodebuild ... -scheme cmux-unit ... build-for-testing` (TEST BUILD
SUCCEEDED) both pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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