CSS variables & theming Guide
Every color, space, radius, and font in VD3 UI is a CSS custom property (--vd-*). Override them in your own stylesheet and the whole system updates — no recompile, no JavaScript. This token layer ships with @vanduo-oss/vd3.
Global overrides
/* Override tokens in your own stylesheet — cascades everywhere */
:root {
--vd-color-primary: #6366f1;
--vd-color-primary-dark: #4f46e5;
--vd-text-on-primary: #ffffff;
--vd-radius-fib-5: 0.5rem;
--vd-font-family-sans: 'Inter', sans-serif;
}Scoped overrides
Custom properties cascade, so you can re-theme one subtree:
/* Scope overrides to a subtree — e.g. a "danger zone" panel */
.danger-zone {
--vd-color-primary: var(--vd-color-danger);
}The three token tiers
| Tier | Examples |
|---|---|
| Palette | --vd-blue-6, --vd-gray-0…9 — active scales (Open Color by default; --vd-oc-*/--vd-fib-* are the raw palette sources) |
| Semantic | --vd-color-primary, --vd-bg-primary, --vd-text-primary, --vd-border-color |
| Component | --vd-btn-border-radius, --vd-card-bg — per-component knobs |
Semantic tokens reference palette tokens; component tokens reference semantic ones. Override at the tier that matches your intent.
Dark mode is the same mechanism
/* Flipping data-theme (or useThemePreference().setTheme) is enough.
The stylesheet already remaps --vd-bg-primary, --vd-text-primary, and
related tokens. Hex overrides below are optional brand tweaks. */
[data-theme="dark"] {
--vd-color-primary: #6366f1; /* optional brand override */
} You rarely write this by hand — useThemePreference().setTheme('dark') or the theme customizer flips data-theme and the stylesheet remaps the tokens.
Bridge an app-owned toggle Vue 3
Already have a light/dark toggle (e.g. @nuxtjs/color-mode, a Pinia store, or your own ref)? The useThemeBridge composable from @vanduo-oss/vd3 keeps VD3 UI in sync with it instead of adding a second source of truth.
import { computed } from 'vue';
import { useThemeBridge } from '@vanduo-oss/vd3';
import { useColorMode } from '@nuxtjs/color-mode'; // any owner of light/dark
// vd3 keys dark mode off [data-theme] on <html>. When another system owns
// the toggle, hand it that system's mode ref and vd3 follows along:
const colorMode = useColorMode();
useThemeBridge(computed(() => colorMode.preference));
// On mount and on every change, the bridge sets [data-theme] AND re-derives
// the default accent for the active scheme — no duplicate toggle UI needed. Pass a Ref<'light' | 'dark' | 'system'>. The bridge re-syncs on mount and whenever the ref changes — useful for SSR / Nuxt apps where the host framework owns color mode.
Motion & Animation Tokens
VD3 UI transitions are driven by --vd-duration-* tokens based on the Fibonacci sequence and --vd-ease-* tokens based on golden-ratio cubic-bezier curves:
| Variable | Default Value | Recommended Use |
|---|---|---|
--vd-duration-instant | 55ms | Active states, tap feedback |
--vd-duration-fast | 89ms | Toggles, icons, reduced-motion crossfades |
--vd-duration-snappy | 144ms | Tooltips, small badges |
--vd-duration-normal | 233ms | Dropdowns, selects, chips |
--vd-duration-moderate | 377ms | Drawers, modals, offcanvas |
--vd-duration-slow | 610ms | Accordions, code snippets, large unfolds |
--vd-duration-gentle | 987ms | Page transitions, hero unfolds |
--vd-ease-out | cubic-bezier(0.16, 1, 0.3, 1) | Entrances, reveals, unfolds (golden curve) |
--vd-ease-in | cubic-bezier(0.7, 0, 0.84, 0) | Exits, dismissals, closing dialogs |
--vd-ease-in-out | cubic-bezier(0.65, 0, 0.35, 1) | Symmetric transitions (tabs, loops) |
Override any duration token globally on :root or locally within a component wrapper. See the Motion foundation guide for live demos.