Theme Customizer
VdThemeCustomizer changes the palette, primary color (Unified | Split across Light & Dark), neutral scale, border radius, font, and Fibonacci motion tempo — and can dynamically tint your SVG favicon and brand marks. Choose studio (Studio Unfold, used in this site's Oola dock and great for navbars too), panel for a classic 320px sidebar, or swatches for a compact primary-only radial fan.
Studio Unfold
variant="studio" works in VdDock, VdNavbar, or standalone toolbars: clicking the trigger duplicates the host glass bar, smoothly shrinks and spins it 90° around the trigger center until vertical, and morphs into Theme Studio. It defaults to Full mode — unfolding 24 vivid primary and 12 temperature neutral frosted swatch-blade circles alongside rich Typography, Border Radius, and animated Motion demos, plus a header switch to Compact mode and a Unified | Split primary scope toggle:
<template>
<!-- Works in Oola docks, navbars, or standalone toolbars (Full XL default + Compact toggle) -->
<VdThemeCustomizer
variant="studio"
studio-size="full"
favicon
/>
</template>Fibonacci-shape swatches
The flared paddles inside Full Studio are VdColorRosette with shape="blade". Same component, two palettes: Open Color hex on the left, Fibonacci step 6 on the right. Neither wheel writes the page theme.
Open Color
Fibonacci
Panel variant (Classic Sidebar)
The default <VdThemeCustomizer> (variant="panel") renders a paint-roller trigger and teleports a 320px sidebar panel under it — every change applies to this page immediately:
The buttons demonstrate open() and close(). The built-in trigger toggles the panel.
Demo changes are temporary and reset on page reload. Only choices made in the site dock are saved.
Swatches variant
variant="swatches" drops the 320px panel for a primary-only fan hinged at the trigger — ideal for compact toolbars. swatches curates which hues appear, direction sets the axis, and preview (on by default) applies a hue on hover and puts the old one back if you leave without picking.
Blades always render in PRIMARY_COLORS order rather than the order you list them, and that order is not alphabetical — teal comes before blue. direction="auto" aims the fan away from the nearest viewport edge, which is not the same as aiming it where there is the most room; chrome that migrates between edges (a dock, say) should pass an explicit direction.
Open Color
primary = "violet"Fibonacci
primary = "violet" Open Color vs Fibonacci, same component, data-palette.
These fans run controlled, so each writes the local ref beside it and leaves the site theme alone. The fan teleports to body, so this demo pins data-palette on each fan. A wrapper around the trigger is not an ancestor of the blades.
Controlled primary
Unbound, the component both reads and writes useThemePreference(). Bind :primary and it switches to controlled mode: it renders from your value and reports every change — hover previews included — through @update:primary, touching the singleton never.
Reach for this when the app already owns the hue and needs to clamp or transform it. This site does exactly that: its store narrows primary to Ink plus the twelve accretion fan hues. Hover previews use @update:primary; committed selections use @select:primary. Only the latter are saved by the site dock. Full-panel demo changes reset to the docs defaults on reload.
Usage
Drop the component anywhere — it brings its own trigger and panel:
<script setup lang="ts">
import { VdThemeCustomizer } from "@vanduo-oss/vd3";
</script>
<template>
<!-- Renders its own trigger button + teleported panel -->
<VdThemeCustomizer />
</template> Mount it once (typically in your navbar). Any other button can open it by dispatching the vd:open-customizer window event.
Panel Sections
- Palette: Open Color (default) or Fibonacci (golden-angle) — shown when
show-paletteis true - Primary Color: 24 color options (including vivid Crimson, Vermilion, Gold, Forest, Cobalt, Deep Purple)
- Neutral Color: 12 temperature-graded scales (Obsidian, Charcoal, Graphite, Slate, Mist, Gray, Zinc, Neutral, Ash, Stone, Taupe, Sand)
- Border Radius: 5 presets (0, 0.125, 0.25, 0.375, 0.5)
- Font Family: 6 options (Nunito, JetBrains Mono, System Default, Ubuntu, Lato, Open Sans)
- Motion: 4 Fibonacci tempo stops (Off, Reduce, Auto, Full)
- Reset: restore every field to defaults
Color mode (light / dark / system) is owned by VdThemeSwitcher; both share the same singleton.
Available Primary Colors
Available Neutral Colors
Neutral colors affect backgrounds, borders, and text throughout the framework.
Programmatic Control
Open/close a specific instance, or any mounted one:
Theme Singleton API
The customizer is a thin UI over useThemePreference() — you can read or drive the same state directly:
API Reference
Props
| Prop | Type | Description |
|---|---|---|
variant | "panel" | "swatches" | "studio" | Default "panel" — classic 320px sidebar editor. "swatches" renders a hinged primary-only radial fan. "studio" ("Studio Unfold") glides a single glass surface from the host dock/navbar edge (610ms open / 377ms fold) into Theme Studio. |
studioSize | "full" | "compact" | Default "full" — extra-large modal with twin 360° golden-ratio flared-bulb SVG swatch rosettes, ~2× larger homogenous color circles, and visual mini-demos; "compact" renders a 28rem twin-ring card. |
studioAlign | "dock-end" | "center" | "trigger" | Default "dock-end" — aligns the Studio edge flush with the host dock/navbar ending line on the trigger's half; "center" centers on the host bar; "trigger" aligns flush with the trigger button. |
showScheme / theme | boolean / "light" | "dark" | "system" | showScheme defaults to true and renders the Light | Dark | System header switcher in studio mode. Optionally bind :theme for controlled scheme state. |
copyable | boolean | Default true. Renders a header Copy button in studio mode that writes a live setThemeDefaults({ ... }) snippet to the clipboard and emits copy. |
showPrimaryMode | boolean | Default true. Renders the Unified | Split primary color scope toggle (shared hue across Light/Dark vs independent Light & Dark primaries) in studio and panel variants. |
primaryMode | "unified" | "split" | Optional controlled binding for the Unified | Split primary scope. Unbound reads and writes useThemePreference().primaryScope. |
favicon | boolean | ThemeFaviconOptions | Default false. When true (or given options), dynamically updates <link rel="icon"> with a sanitized SVG data URI matching live --vd-brand-* / primary tokens. |
showPalette | boolean | Render the palette-selection switch (Open Color / Fibonacci). Default true. studio and panel variants. |
showFont | boolean | Render the font-family selector. Default true. studio and panel variants. |
showMotion | boolean | Render the motion mode control (auto / full / reduce / off). Default true. studio and panel variants. |
swatches | readonly string[] | Restrict primary options in swatches and studio variants to these PRIMARY_COLORS keys. Unknown keys are ignored; unset or empty offers all 24 hues in PRIMARY_COLORS order. |
direction | "auto" | "up" | "down" | "left" | "right" | Unfold axis for swatches and studio variants, default "auto". Auto points away from the nearest viewport edge. |
preview | boolean | Default true. Applies a primary hue, and a studio neutral scale, on hover and restores the previous value if uncommitted. |
primary | string | Bind to take control: the component renders from this value and reports changes through update:primary instead of writing the useThemePreference() singleton. |
neutral | string | Optional controlled neutral scale. Hover previews emit update:neutral; a click still emits select:neutral. Unbound reads and writes useThemePreference(). |
Emits
| Event | Payload | Description |
|---|---|---|
update:primary / update:neutral / update:primaryMode / update:studioSize / update:theme | (value: string) | Emitted for hover previews and controlled changes of primary or neutral, and when primaryMode, studioSize ('full' | 'compact'), or theme ('light' | 'dark' | 'system') changes. Leaving a swatch emits the committed value again. |
select:primary / select:primaryMode / select:theme | (value: string) | Emitted when a primary swatch, Unified | Split scope switch, or Light | Dark | System scheme button is explicitly selected. |
select:neutral / select:font / select:radius / select:motion / select:palette | (value: string) | Emitted when the user explicitly commits a neutral scale, font family, border radius, motion mode, or palette option. |
copy | (snippet: string) | Emitted with the generated setThemeDefaults({ ... }) snippet when the Studio Copy button is clicked. |
reset | () | Emitted when the user triggers Reset to Defaults. |
Exposed (template ref)
| Member | Description |
|---|---|
open() | Open the customizer panel. |
close() | Close the customizer panel. |
toggle() | Toggle the customizer panel. |
Window Event
| Event | Description |
|---|---|
vd:open-customizer | A mounted VdThemeCustomizer opens its panel when this window event is dispatched — wire it to a navbar trigger. |
CSS API
| Class / Attribute | Description | Type |
|---|---|---|
.vd-theme-customizer | Root wrapper; gains .is-open while the panel is open. | Class |
.vd-theme-customizer-trigger | The built-in paint-roller trigger button (also carries data-theme-customizer-trigger). | Class |
.vd-theme-customizer-overlay | Teleported backdrop; .is-active while open. | Class |
.vd-theme-customizer-panel | Teleported panel <aside role="dialog">; .is-open while open. | Class |
.vd-theme-customizer-fan | Teleported swatches fan <div role="listbox">; .is-open while open, plus a fan-up / fan-down / fan-left / fan-right direction class. | Class |
.tc-fan-item | One blade <button role="option">; .is-active for the current hue, .is-hovered while previewing. Carries data-color with the hue key. | Class |
.vd-theme-customizer-studio | Teleported Studio Unfold wrapper <div role="dialog">; .is-open while open, plus size-full / size-compact and phase-unfolding / phase-morphed / phase-closing. | Class |
.vd-tc-studio-surface | Single glass surface that morphs on one continuous rAF timeline from the host dock pill (swinging 90° around the trigger while tapering) into the rounded Seemore-glass studio anchored to the dock edge. | Class |
.vd-tc-studio-wheel / .vd-tc-studio-card / .vd-tc-studio-slider | Twin 360° swatch-blade rosettes (Full) or dot rings (Compact), Typography & Border Radius specimen cards, and stepped Fibonacci motion slider. | Class |
--vd-brand-lobe-light / -mid / -dark / --vd-brand-ring | Semantic primary-derived SVG brand mark tokens consumed by theme-reactive logos and useThemeFavicon(). | CSS Variable |
--vd-customizer-fan-blade-width / -dot-size / -label-size | Blade geometry: 6.25rem, 1.2rem, 0.68rem by default. | CSS Variable |
--vd-customizer-fan-stagger / -z-index / -blade-radius | Per-blade transition delay (30ms), stacking context (1100), and blade rounding (999px). | CSS Variable |
data-primary / data-neutral | Applied to <html>. Remap the --vd-primary-* / --vd-gray-* CSS variables. | State Attribute |
data-radius / data-font | Applied to <html>. Set --vd-radius-scale and the font stack (data-font removed for system). | State Attribute |
data-palette | Applied to <html> (open-color or fibonacci). Swatch blades read it from any ancestor. The fan teleports to <body>, so a wrapper around the trigger does not reach them. | State Attribute |
localStorage Keys
| Key | Default | Description |
|---|---|---|
vanduo-palette | open-color | Active palette (Open Color / Fibonacci) |
vanduo-primary-color | black / amber | Primary brand color (auto default per scheme) |
vanduo-neutral-color | stone / charcoal | Neutral / gray scale (docs: stone light, charcoal dark) |
vanduo-radius | 0.5 | Border radius scale |
vanduo-font-preference | nunito | Font family |
vanduo-theme-preference | system | Color mode (shared with VdThemeSwitcher) |
vanduo-primary-mode / -primary-color-light / -primary-color-dark | unified (docs: split) | Unified vs Split Light/Dark primary scope and per-scheme primary slots |
vanduo-motion | auto (absent) | Motion tempo preference (full / reduce / off; removed when auto) |
Coordination with VdThemeSwitcher
Both components read and write the same useThemePreference() singleton, so they never clobber each other:
- Picking a color/neutral/radius/font in the customizer leaves the switcher's mode untouched
- Switching mode in the switcher re-derives the auto-default primary but never overwrites a color you chose
- Every field is shared through reactive state. Automatic storage is enabled by default; these docs disable it for temporary demos.