Searching Puzzle Pieces

Type to search Puzzle Pieces.

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.

Theme
Style

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 OS

The 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

Theme
Style

{ scheme: 'warm', mode: 'mixed' }

A subset of palettes, no System tile

Theme
Style

Props

PropTypeNotes
schemestringThe current palette value ('default' | 'cool' | 'warm' | 'void', or any value in `schemes`).
modestring | nullThe 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.
schemesarray[{ value, label, description? }] — the cards. Defaults to the four bundled palettes.
modesarray[{ value, label, description? }] — the style tiles. Defaults to dark, dim, mixed, light.
systembooleanShow the System tile (default true). Picking it fires @change with mode: null.
schemeLegend / modeLegendstringGroup headings (default 'Theme' / 'Style').
@change({ scheme, mode }) => voidFires on every pick with the full choice, value-first.