Skip to content

feat(theme): set S2Code Dark as default theme - #525

Merged
shuv1337 merged 3 commits into
integration-v2from
s2-dark-default
Nov 29, 2026
Merged

shuv1337 merged 3 commits into
integration-v2from
s2-dark-default

Conversation

@shuv1337

Copy link
Copy Markdown
Owner

Summary

Sets S2Code Dark (s2-dark) as the default theme for both the shuvcode Terminal UI (packages/tui) and Web/App UI (packages/ui + packages/app), unifying the palette around deep obsidian-slate surfaces (#0c1119 / #121923 / #161d28 / #1b232f / #1f2835), crisp cool-white/slate typography, and calm steel-blue accents (#60a5fa / #93c5fd / #2f6fb8) with zero purple/indigo tints and no amber/yellow primary chrome.

All existing built-in themes (nightowl, opencode, opencode-classic, oc-2, etc.) and custom user themes remain selectable and unchanged.

Key Changes

  • Terminal UI (packages/tui):
    • Added native V2 theme packages/tui/src/theme/assets/v2/s2-dark.json (base + dark + light) with steel-blue categorical[0] (Build badge & composer left border), quiet slate scrollbars, crisp white bold markdown (#f8fafc), exact semantic diff/status colors, and full WCAG AA contrast in both modes.
    • Added fork-only packages/tui/src/theme/default.ts (DEFAULT_THEME_NAME = "s2-dark", getS2DarkTheme(), getDefaultTheme()), re-exported from theme/index.ts, registered "s2-dark" in listThemes(), and restored theme/v1.ts to upstream.
    • Updated packages/tui/src/mini/theme.ts to use getDefaultTheme() instead of DEFAULT_THEMES[DEFAULT_THEME_NAME].
    • Updated packages/tui/src/component/prompt/metadata.tsx effort/variant badge from theme.text.feedback.warning.base to theme.text.formfield.selected (semantic token fix per AGENTS.md).
    • Added packages/tui/test/theme/s2-dark.test.ts (registration, contrast >= 4.5, no-purple OKLCH guard, surface hierarchy) and updated TUI theme tests; restored diff-viewer.test.tsx to upstream.
  • Web / App UI (packages/ui + packages/app):
    • Added packages/ui/src/theme/themes/s2-dark.json (id: "s2-dark", name: "S2Code Dark") mapped via v2-grey-* primitives (preserving v1CodeAndDiffBridge and passing v2/resolve.test.ts across both modes) with zero purple/indigo tints.
    • Registered "s2-dark": "S2Code Dark" in packages/ui/src/theme/context.tsx and added packages/ui/src/theme/s2-dark.test.ts (no-purple guard across legacy & v2 resolve paths).
    • Passed defaultTheme="s2-dark" to <ThemeProvider> in packages/app/src/app.tsx (keeping DEFAULT_THEME_ID = "oc-2" in machine.ts so s2-dark caches cleanly in localStorage with zero FOUC and minimal upstream diff).
    • Updated packages/app/public/oc-theme-preload.js and packages/app/src/theme-preload.test.ts (default "s2-dark", dark #121923 / light S2 bg-deep, preserving "oc-2" fast path + drift guard).
    • Pinned packages/app/playwright.config.ts default storage theme to "oc-2" so existing oc-2-specific e2e color assertions remain green while per-test theme selections still override it.

Feature Flag

No feature flag: this is a default theme update for shuvcode with all prior themes (nightowl, opencode, oc-2, etc.) preserved and immediately selectable.

Visual

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 72" width="240" height="72" fill="none">
  <rect x="6" y="6" width="228" height="60" rx="8" stroke="currentColor" stroke-opacity="0.22" stroke-width="1.5"/>
  <rect x="14" y="14" width="52" height="44" rx="4" fill="currentColor" fill-opacity="0.06"/>
  <rect x="20" y="21" width="32" height="4" rx="2" fill="currentColor" fill-opacity="0.25"/>
  <rect x="20" y="30" width="40" height="8" rx="3" fill="currentColor" fill-opacity="0.14"/>
  <rect x="20" y="43" width="28" height="4" rx="2" fill="currentColor" fill-opacity="0.18"/>
  <rect x="74" y="14" width="152" height="22" rx="4" fill="currentColor" fill-opacity="0.04"/>
  <rect x="82" y="20" width="76" height="4" rx="2" fill="currentColor" fill-opacity="0.45"/>
  <rect x="82" y="28" width="110" height="3.5" rx="1.75" fill="currentColor" fill-opacity="0.2"/>
  <rect x="74" y="41" width="152" height="17" rx="4" fill="currentColor" fill-opacity="0.09"/>
  <rect x="74" y="41" width="3" height="17" rx="1.5" fill="currentColor" fill-opacity="0.85">
    <animate attributeName="fill-opacity" values="0.85;0.45;0.85" dur="2.8s" repeatCount="indefinite"/>
  </rect>
  <rect x="84" y="47.5" width="24" height="4" rx="2" fill="currentColor" fill-opacity="0.7"/>
  <rect x="114" y="47.5" width="36" height="4" rx="2" fill="currentColor" fill-opacity="0.32"/>
  <rect x="156" y="47.5" width="22" height="4" rx="2" fill="currentColor" fill-opacity="0.5"/>
  <circle cx="215" cy="49.5" r="4" fill="currentColor" fill-opacity="0.65">
    <animate attributeName="r" values="3.5;4.5;3.5" dur="2.8s" repeatCount="indefinite"/>
  </circle>
</svg>

Verification

  • packages/tui: bun run test (1878 pass, 2 skip, 0 fail), typecheck, typecheck:tsc
  • packages/ui: bun run test (692 pass, 0 fail), typecheck, typecheck:tsc
  • packages/app: unit (2911 pass, 0 fail), browser (389 pass, 0 fail), typecheck, typecheck:tsc
  • Repo root: bun run check (40/40 green), git diff --check clean
  • Visual inspection of real rendered TUI (dark & light, home/session/sidebar/diff/theme picker) and Web App (dark & light, home/session/settings/theme picker) verified zero amber primary chrome and zero purple/indigo tints.

Add S2Code Dark (s2-dark) as a native V2 TUI theme and a bundled web/app
theme, and make it the default in both. Calm steel-blue accents replace the
amber chrome (Build badge, composer border, scrollbar, bold text, effort
label); amber stays reserved for warnings. Both modes are provided and no
purple or indigo colors resolve in either.

- tui: fork-only theme/default.ts owns DEFAULT_THEME_NAME and
  getDefaultTheme(); v1.ts returns to upstream. mini falls back to the
  default document instead of a V1 entry.
- tui: the prompt effort label uses text.formfield.selected instead of the
  warning feedback token.
- ui/app: s2-dark.json keeps the v1 bridge active (canvas pinned via grey
  primitives) so the bundled-theme contrast contract covers it. The app
  passes defaultTheme="s2-dark"; oc-2 stays the built-in fallback. The
  preload paints S2 backgrounds for the default and keeps oc-2's for oc-2.
- e2e pins oc-2 through storageState so OpenCode color assertions hold.

nightowl, opencode, oc-2 and every other theme remain selectable.
@shuv1337 shuv1337 added the full-tests Run the full test suite (unit and e2e) on this PR label Nov 29, 2026
- tui: an invalid custom file named like the default theme recovers to the
  built-in S2Code Dark and reports the error; only the built-in default
  itself is unrecoverable. A valid same-name file still overrides it.
- tui: the prompt effort label keeps text.formfield.selected only where it
  reaches 4.5:1 on the composer fill, else uses text.base (Cobalt2, Vercel
  and Dracula dark fell below).
- ui: ThemeProvider bundles S2Code Dark eagerly when it is the default, so a
  fresh window applies and caches it on the first transition. The theme
  machine gains optional initialThemes and fallbackId; failed or missing
  themes fall back to S2Code Dark there, and oc-2 stays the built-in default
  without them.
- app: the preload tolerates blocked storage, paints S2's deep background
  only for s2-dark, and injects it on a first start with no cached colors.
- Light mode: darken TUI diff gutter, context and sign colors, and web
  comment, type, weak and faint text so every rendered pair reaches 4.5:1.
- Tests cover the recovery, fallback, preload paths, the variant label in
  every built-in theme and the light contrast pairs.
…ster

- tui: promptVariantColor measures the selection color composited over the composer fill, so translucent or transparent custom colors fall back to body text.
- ui: the theme machine remembers the fallback's own theme. Withdrawing a theme registered over the fallback's id restores the original instead of keeping the replacement; withdrawing the original stays a no-op, and oc-2 handling is unchanged.
@shuv1337

Copy link
Copy Markdown
Owner Author

CI Disposition (e2e pre-existing upstream toBeFocused() flakes)

6/7 CI checks passed on cbb1d18e1e (unit, typecheck, hygiene, plugin-browser, and both Socket Security checks) alongside dual cross-family review approval (Neon R2 + Astra R3).

Across 4 runs of e2e on cbb1d18e1e, every one of the 836 app e2e tests and 414 component tests passed with zero theme, preload, settings, or color-assertion failures:

  • Run 1 (141196942620): tabs.spec.ts:2786 passed; mobile-session.spec.ts:307 failed (toBeFocused)
  • Run 2 (141204488274): mobile-session.spec.ts:307 passed (flaky); tabs.spec.ts:2786 failed (toBeFocused)
  • Run 3 (141209907132): mobile-session.spec.ts:307 passed (1st try); tabs.spec.ts:2786 failed (toBeFocused)
  • Run 4 (141215419486): tabs.spec.ts:2786 passed (flaky); mobile-session.spec.ts:307 failed (toBeFocused)

Both failures are pre-existing upstream focus-timing flakes (mobile-session.spec.ts:307 also failed 2 retries on integration-v2 PR #524 run 140473924608; tabs.spec.ts:2786 comes from upstream b64f928fd0 #66547 in focus-rescue.tsx). Recorded per AGENTS.md and approved for merge into integration-v2.

@shuv1337
shuv1337 merged commit 8ffba35 into integration-v2 Nov 29, 2026
9 of 13 checks passed
@shuv1337
shuv1337 deleted the s2-dark-default branch November 29, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-tests Run the full test suite (unit and e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant