Theme customizer Guide

VD3 UI themes by writing data-* attributes on <html> — the CSS reads them. In Vue 3 the useThemePreference() singleton sets those attributes, persists the choice to localStorage, and re-applies it on load.

Setting the theme
// VD3 UI theming is a reactive singleton, not global JS calls
import { useThemePreference, useThemeFavicon } from '@vanduo-oss/vd3';

const theme = useThemePreference();
theme.setTheme('dark');           // 'system' | 'light' | 'dark'
theme.setPalette('fibonacci');     // 'open-color' | 'fibonacci'
theme.setPrimaryMode('split');     // 'unified' (shared) | 'split' (per Light/Dark)
theme.setPrimary('crimson');       // brand hue (saved per scheme when 'split')
theme.setNeutral('obsidian');      // 12 temperature-graded neutral scales
theme.setRadius('0.5');            // corner radius scale
theme.setFont('lato');             // base font family
theme.reset();                     // back to defaults

// Optional: keep <link rel="icon"> synced with --vd-brand-* / primary colors
useThemeFavicon();
What it sets

useThemePreference() writes these attributes; the framework CSS does the rest:

<!-- Explicit dark example. For theme === 'system', data-theme is removed
     (not set to "system") so prefers-color-scheme can apply. -->
<html
  data-theme="dark"
  data-palette="open-color"
  data-primary="violet"
  data-neutral="slate"
  data-radius="0.5"
  data-font="lato">
Customization attributes
AttributeValuesControls
data-themesystem · light · darkColor mode. system removes the attribute so prefers-color-scheme applies.
data-paletteopen-color · fibonacciActive color palette (Open Color is the default).
data-primary24 hues (e.g. crimson, cobalt, violet, teal)Brand color ramp
data-neutral12 ramps (e.g. obsidian, charcoal, slate, sand)Neutral / surface colors
data-radius0 · 0.125 · 0.25 · 0.375 · 0.5Corner-radius scale (rem)
data-fontubuntu, nunito, lato, …Base font family
data-motionauto · full · reduce · offFibonacci motion tempo (auto removes attribute)

The option lists (hue names, neutrals, radii, fonts) come from @vanduo-oss/vd3 so they match its token catalog exactly — see VD3 UI Ecosystem.

Persistence
// Preferences persist in localStorage and re-hydrate automatically.
// Keys follow storagePrefix (default "vanduo-"):
//   {prefix}palette, {prefix}primary-color, {prefix}neutral-color,
//   {prefix}radius, {prefix}font-preference, {prefix}theme-preference
// Example with the default prefix: vanduo-theme-preference
// Pass storagePrefix to VanduoVue when two apps share an origin.
// useThemePreference() reads them on first client access — there is no init().