Appearance Picker
A controlled palette + style picker. Each theme card is a live miniature of the app shell painted in the palette it offers — a real surface scoped with data-scheme, not a picture — and each style tile (Dark, Dim, Mixed, Light, plus System) is the current palette painted in that style. It owns no state: pass the current choice and hear @change.
This one is wired to the site's appearance module, so picking here repaints the docs shell — the same thing the rail's footer button opens in a popover.
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece appearance-picker
Requires the theme files (themes/default.css plus any palette you offer) and, to persist the choice, the appearance export — see Theming.
Usage
import AppearancePicker from '@/components/ui/AppearancePicker.pzl';
import { current, set } from '@magic-spells/puzzle-pieces/appearance';<AppearancePicker scheme={ scheme } mode={ mode } @change={ apply }/>
// data(): const { scheme, mode } = current();
// events: apply: (choice) => set(choice) // { scheme, mode } — mode null = follow the OSThe piece is the form, not the popover. Put it on a settings page, or in a popover parked in a corner the way the docs shell does — non-modal, so the app repaints in view as you click.
Controlled, without persisting
{ scheme: 'warm', mode: 'mixed' }
A subset of palettes, no System tile
Props
| Prop | Type | Notes |
|---|---|---|
| scheme | string | The current palette value ('default' | 'cool' | 'warm' | 'void', or any value in `schemes`). |
| mode | string | null | The current style: 'dark' | 'dim' | 'mixed' | 'light'; null means follow the operating system and selects the System tile. Named mode because style is the HTML attribute. |
| schemes | array | [{ value, label, description? }] — the cards. Defaults to the four bundled palettes. |
| modes | array | [{ value, label, description? }] — the style tiles. Defaults to dark, dim, mixed, light. |
| system | boolean | Show the System tile (default true). Picking it fires @change with mode: null. |
| schemeLegend / modeLegend | string | Group headings (default 'Theme' / 'Style'). |
| @change | ({ scheme, mode }) => void | Fires on every pick with the full choice, value-first. |