Themes
Every piece is styled through the same design tokens (bg-surface, text-ink, border-border, bg-brand), defined once in pieces.css. A palette restates those tokens, so switching one restyles every piece at once.
puzzle add theme with no name lists the palettes: default (installed with the first piece), cool, warm and void. Add one by name:
$ puzzle add theme warm
puzzle add theme · npm:@magic-spells/puzzle-pieces@0.9.0
✓ warm · app/styles/themes/warm.css
Next steps
→ add `@import './themes/warm.css';` to app/styles/styles.css (after `@import './pieces.css';`)
→ switch with data-scheme="warm" on <html>; modes: data-theme="dark|dim|mixed|light"
A palette file does nothing until it is selected. Its tokens sit under [data-scheme='warm'], so data-scheme="warm" on <html> switches the whole app, and on any other element just that part of the page. Light and dark come from the visitor's system, or from data-theme.
Your turn
- In
styles.css, import the palette after the tokens:@import './themes/warm.css';. - In
app/public/index.html, switch to it:<html lang="en" data-scheme="warm">. - Open a quick look and add an album. The dialog and the toast are warm now: ivory and tan in light mode, brown in dark, with a clay accent. Music's own colours come from
app.cssand stay as they are.
Try cool or void too: add it the same way and change one attribute.