Skip to content

feat(theme): lay out migrated V1 themes on opencode2 steps under new designs - #59996

Merged
jlongster merged 2 commits into
devfrom
new-designs-v1-theme-steps
Oct 28, 2026
Merged

jlongster merged 2 commits into
devfrom
new-designs-v1-theme-steps

Conversation

@jlongster

@jlongster jlongster commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

With the new-designs experiment on, the new components expect hue steps laid out like opencode2: text on neutral 100/200/300, the page on 900, raised surfaces on 700/600/500, the vivid color on 400, and a quiet tint on 600 for the focused row. Migrated V1 themes still used the old layout (vivid color on 200, page on 800). So under the experiment they got a vivid selected row and surfaces that barely separate from the page.

A new migrateV1NewDesigns in packages/theme/src/tui/v1-migrate-new-designs.ts handles the experiment. v1-migrate.ts only exports the helpers it shares, and its output is unchanged. The new migration:

  • The V1 colors keep their values but move to the opencode2 positions: background on 900, text on 100, primary/accent/feedback colors on 400. The theme's muted text goes on whichever of 200/300 is closer in lightness.
  • The missing steps are generated with lightness and chroma offsets measured from opencode2. Only lightness and chroma come from opencode2; hue and tint come from the V1 theme.
  • Generated surfaces and selection steps are pulled back toward the page until text on them keeps opencode2's share of the text/page contrast (and 4.5:1 where the theme allows). They stop at 60% of the way so they stay visible in low-contrast themes.
  • Token mapping and the light dialog overrides follow opencode2.
  • Transparent V1 surfaces (background, backgroundPanel, backgroundElement) stay transparent, so transparent themes still show the terminal through.

parseTheme in the TUI picks migrateV1NewDesigns or migrateV1 based on the experiment flag and caches each result separately.

How did you verify your code works?

  • Added tests to packages/tui/test/theme/v2/v1-migrate.test.ts:
    • The tokyonight layout keeps its anchors, its surfaces get lighter step by step, and the selected row stays readable and low-saturation.
    • Transparent backgrounds and panels stay transparent.
    • Every built-in theme migrates under new designs.
  • bun test for the theme package and the TUI theme/mini suites, plus tsc for both packages.
  • Compared tokyonight, catppuccin, gruvbox, everforest, github and solarized against opencode2 in dark and light mode, using headless OpenCode Drive screenshots of a session and the session picker.

Text contrast on the selected row (dark): tokyonight 5.4 → 8.1, catppuccin 5.2 → 8.0, gruvbox 4.7 → 7.5, everforest 3.1 → 5.2.

Screenshots / recordings

To be attached.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: adds migrateV1NewDesigns to @opencode/theme/tui (backwards compatible)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described. With new-designs on, tokyonight's command palette shows a quiet tint on the selected row instead of the vivid primary bar, and the raised surfaces separate from the page (before/after below). The theme and TUI theme tests pass, and tsc reports no errors in either package.

Public API: unchanged. migrateV1 and parseTheme gain an optional { newDesigns } argument, and existing callers behave as before.

One concern, see the inline comment: under new designs, a transparent V1 background becomes a solid colour. This affects the built-in system theme and any theme with background: "none".

Before

After

Comment thread packages/theme/src/tui/v1-migrate.ts Outdated
scale[step] = oklchToHex(color)
}
lightness[900] = pageLightness
scale[900] = opaque(theme.background) ? hex(theme.background) : oklchToHex({ ...surfaceTint[900], l: pageLightness })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When theme.background is transparent, step 900 gets a generated solid colour. That makes background.base solid under new designs. This affects the system theme (its background is the terminal colour with alpha 0) and any V1 theme with background: "none". I checked with generateSystem and a terminal background of #101010: background.base is alpha 0 with the flag off but solid #121212 with newDesigns. tokyonight with background: "none" gives transparent vs #111322. So the page no longer shows the terminal's own background, and it can visibly differ from it.

The current migration keeps the transparent value, so it would be good to keep hex(theme.background) at 900 here too and use pageColor only to work out the other steps and the contrast.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transparency point is fixed: under new designs, transparent V1 surfaces now stay transparent. I checked the system theme and tokyonight with background: "none", and both keep a transparent page. The selected row in the command palette still looks as described with tokyonight. Theme tests pass and tsc reports no errors in either package. Nothing new to raise.

Public API: @opencode/theme/tui adds a migrateV1NewDesigns export, and parseTheme takes an optional { newDesigns } argument. Both are backwards compatible.

Before

After

@jlongster
jlongster merged commit b799259 into dev Oct 28, 2026
24 checks passed
@jlongster
jlongster deleted the new-designs-v1-theme-steps branch October 28, 2026 20:55
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