Skip to content

feat(theme): register native V2 opencode theme - #49846

Merged
jlongster merged 1 commit into
v2from
native-v2-theme
Sep 18, 2026
Merged

jlongster merged 1 commit into
v2from
native-v2-theme

Conversation

@jlongster

@jlongster jlongster commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What

Register packages/tui/src/theme/assets/v2/opencode.json as the built-in opencode theme and remove the hard-coded DEFAULT_THEME from @opencode/theme.

full TUI opencode → native V2 asset
Mini fallback     → native V2 asset
invalid theme     → native V2 opencode fallback

The old V1 assets/opencode.json remains available as a migration fixture but is no longer used by production fallback paths.

Native asset

The V2 asset is generated from the current V1 OpenCode theme and then minimized:

  • base: complete shared semantic token structure and @dialog
  • light: complete light hue palette
  • dark: complete dark hue palette plus only semantic values that differ from base

Light and dark resolve token-for-token identically to the migrated V1 source.

Remove DEFAULT_THEME

  • Delete the 452-line hard-coded theme in packages/theme/src/tui/defaults.ts.
  • Remove the public DEFAULT_THEME export.
  • Move DEFAULT_CATEGORICAL into the independent categorical.ts module; V1 migration still uses it when no semantic hues can be inferred.
  • Expose getOpenCodeTheme(), which lazily decodes and caches the native asset; use it in the registry, Mini, and tests.
  • Use a migrated V1 fixture in @opencode/theme tests, preserving package dependency direction.
  • Decode and cache the built-in V2 asset only when getOpenCodeTheme() is first called.

Verification

  • Native V2 light = migrated V1 light, token-for-token.
  • Native V2 dark = migrated V1 dark, token-for-token.
  • packages/theme: typecheck; 6 tests pass.
  • packages/tui: typecheck; 101 focused theme/Mini tests pass.
  • Registration visual comparison before the DEFAULT_THEME cleanup: 40/40 states identical across opencode-light, opencode-dark, catppuccin-light, and dracula-dark.

Remove text.status

The native migration exposed that text.status was a session-tab-specific namespace. Remove it from partial/complete schemas, resolved types, V1 migration, and the native asset. Consumers now use explicit hues at the requested step:

  • running → hue.accent[800]
  • permission/question/activity unread → hue.interactive[800]
  • error unread → text.feedback.error.base (unchanged)

@jlongster
jlongster force-pushed the native-v2-theme branch 6 times, most recently from 50e97e5 to 894f5eb Compare September 18, 2026 20:30
Register a native V2 OpenCode theme for the full TUI and Mini fallback paths,
remove the old hard-coded DEFAULT_THEME, and keep DEFAULT_CATEGORICAL in its own
module. The native asset is decoded lazily through getOpenCodeTheme().

Remove text.status from the public theme schema. Session running indicators now
use accent[800], while permission, question, and activity-unread indicators use
interactive[800]. Error-unread indicators continue to use feedback.error.
@jlongster
jlongster merged commit 168aba6 into v2 Sep 18, 2026
10 checks passed
@jlongster
jlongster deleted the native-v2-theme branch September 18, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant