Repository navigation
Preview palettes on hover in Settings → Appearance - #3108
Merged
SawyerHood merged 4 commits intoSep 8, 2026
Merged
Conversation
## What was wrong
Choosing a palette in Settings → Appearance was a blind commit: the dropdown listed names only, so seeing what Nord or a custom theme looked like meant activating it, which persisted the selection server-side and repainted every window. Custom and plugin palette CSS is only ever sent as the active appearance, so the client had no way to look at a theme it had not activated.
## What changed
- Hovering or arrow-keying over a palette item now applies that theme to the current window as an ephemeral preview. Leaving the item, closing the menu, or leaving Settings restores the committed theme. Selecting an item keeps the preview in place until the saved appearance lands, so there is no flash back to the old palette.
- `apps/app/src/lib/themes/index.ts` and `lib/code-theme.ts` gain a preview layer over the committed palette CSS and code theme. Previews never touch the localStorage pre-paint cache, and a committed apply always supersedes a preview.
- New `useAppThemePreview` hook resolves themes through react-query (`systemTheme` query key, 60s stale time) and prefetches every listed palette when the menu opens so the first hover applies from cache. Resolved themes are invalidated with system config, including realtime `config-changed`.
- New route `GET /api/v1/settings/themes/:id` resolves a built-in, custom, or plugin theme without activating it (400 for a malformed id, 404 for a missing custom theme). The server shares the validation with `PUT /settings/appearance`. No host-daemon wire change, so `HOST_DAEMON_PROTOCOL_VERSION` is unchanged.
- SDK: `sdk.theme.resolve({ themeId })`. CLI: `bb theme show [id] [--css]` resolves a theme by id without activating it. Updated the CLI guide (`bb-guide-customization.md`) and the bb-cli skill reference (`theme-commands.md`).
- Bumped `@get-bb/plugin-sdk` to 0.4.48 with `scripts/bump-plugin-sdk.mjs` because the bundled `ThemeArea` type changed and 0.4.47 is already on npm.
## How you verified
- New tests: `apps/app/src/lib/themes/preview.test.ts` (preview does not persist, commit supersedes preview), `apps/app/src/hooks/useAppThemePreview.test.tsx` (stale resolutions ignored, cache reuse, prefetch, unmount clears), `apps/app/src/views/SettingsView.palette-preview.test.tsx` (focus/blur/Escape/select flows, prefetch on open), `packages/sdk/test/sdk.test.ts` (`theme.resolve` transport), and `tests/integration/fake/smoke/theme-resolve.test.ts` (built-in, custom, 404, 400, active theme untouched).
- `pnpm exec turbo run typecheck lint` across the repo passed.
- `pnpm exec turbo run test --filter=@bb/app --filter=@bb/cli --filter=@bb/sdk --filter=@bb/server-contract` passed (483 app files, 54 CLI files, 6 SDK files, 7 contract files).
- `node packages/plugin-sdk/scripts/check-npm-version-guard.mjs` passed for 0.4.48.
- `oxfmt --check` on every changed file and `git diff --check` passed.
Fixes: no linked issue.
Contributor
|
Thanks @vznh for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval. |
Collaborator
|
/approve @vznh |
Contributor
Author
|
happy to merge / make any adjustments! @SawyerHood |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
Choosing a color palette in different editors (take Zed) allows you to preview when scrolling through them on Command Palette - wanted to bring similar functionality here.
If I had to choose, I would also do a transition-colors but deemed that unnecessary.
What was wrong
Choosing a palette in Settings → Appearance required users to choose the selection in order to preview it. Takes a lot of time to review themes and a bit harder to choose from there.
What changed
apps/app/src/lib/themes/index.tsandlib/code-theme.tsgain a preview layer over the committed palette CSS and code theme. Previews never touch the localStorage pre-paint cache, and a committed apply always supersedes a preview.useAppThemePreviewhook resolves themes through react-query (systemThemequery key, 60s stale time) and prefetches every listed palette when the menu opens so the first hover applies from cache. Resolved themes are invalidated with system config, including realtimeconfig-changed.GET /api/v1/settings/themes/:idresolves a built-in, custom, or plugin theme without activating it (400 for a malformed id, 404 for a missing custom theme). The server shares the validation withPUT /settings/appearance. No host-daemon wire change, soHOST_DAEMON_PROTOCOL_VERSIONis unchanged.sdk.theme.resolve({ themeId }). CLI:bb theme show [id] [--css]resolves a theme by id without activating it. Updated the CLI guide (bb-guide-customization.md) and the bb-cli skill reference (theme-commands.md).@get-bb/plugin-sdkto 0.4.48 withscripts/bump-plugin-sdk.mjsbecause the bundledThemeAreatype changed and 0.4.47 is already on npm.How you verified
Hand-tested.
Screen.Recording.2026-09-04.at.11.32.58.PM.mov
Additionally:
apps/app/src/lib/themes/preview.test.ts(preview does not persist, commit supersedes preview),apps/app/src/hooks/useAppThemePreview.test.tsx(stale resolutions ignored, cache reuse, prefetch, unmount clears),apps/app/src/views/SettingsView.palette-preview.test.tsx(focus/blur/Escape/select flows, prefetch on open),packages/sdk/test/sdk.test.ts(theme.resolvetransport), andtests/integration/fake/smoke/theme-resolve.test.ts(built-in, custom, 404, 400, active theme untouched).pnpm exec turbo run typecheck lintacross the repo passed.pnpm exec turbo run test --filter=@bb/app --filter=@bb/cli --filter=@bb/sdk --filter=@bb/server-contractpassed (483 app files, 54 CLI files, 6 SDK files, 7 contract files).node packages/plugin-sdk/scripts/check-npm-version-guard.mjspassed for 0.4.48.oxfmt --checkon every changed file andgit diff --checkpassed.Fixes: no linked issue.