Skip to content
Español

Navigate

Type to search. Press Escape to close.

    Foundations

    Tokens and themes

    Every visual decision is a custom property prefixed --iv-, generated from one JSON source. Override any of them on :root or on a scope; nothing needs recompiling.

    :root {
      --iv-color-primary: #4338CA;      /* your brand */
      --iv-color-on-primary: #FFFFFF;
      --iv-radius-md: 0.25rem;
    }
    .checkout { --iv-button-radius: var(--iv-radius-full); }  /* component-local */

    New in 1.1 · the headline

    One colour repaints the whole system.

    Pick a primary. Buttons and their gradient, focus rings, links, badges, progress, switches, chips and gradient text follow it, because iVOLT 1.1 mixes every token that depends on it in CSS, with color-mix(). No build, no JavaScript, no fifteen variables by hand.

    Pick a primary colour

    Measured contrast (WCAG 2), worst case of the text on the button (at rest and on hover) and the colour as a link:light 7.0:1 · dark 8.2:1light 6.2:1 · dark 6.9:1light 7.1:1 · dark 8.0:1light 5.4:1 · dark 9.6:1light 5.0:1 · dark 11.1:1light 14.8:1 · dark 14.6:1

    All it takes
    :root {
      --iv-color-primary: #BE123C;
      --iv-color-on-primary: #FFFFFF;
    }

    Gradient text

    DeployPreview
    BetaNewA text link
    Focus ring

    Ten tokens, one seed

    • --iv-color-primarythe seed
    • --iv-color-primary-hoverhover
    • --iv-color-primary-activepressed
    • --iv-color-primary-subtletint
    • --iv-color-primary-borderedge
    • --iv-color-focusfocus ring
    • --iv-glow-primaryglow
    • --iv-focus-halohalo
    • --iv-gradient-brandbrand gradient
    • --iv-gradient-primarybutton gradient

    Sample controls: they do nothing here.

    Where the mixing happens, and palettes

    New in 1.1 The ten derived tokens are declared once, as color-mix(in oklab, var(--iv-color-primary), var(--iv-mix-<name>)), on :root, on every [data-iv-theme] scope and on every [data-iv-palette] scope. That is where you set the primary: on :root for the whole site, or on one of those scopes for a part of it. On any other element the derived tokens are already computed by the time they are inherited, so changing the primary on a plain <div> recolours the primary itself but not its hover or its gradient — add data-iv-palette (with no value) to that element and it re-mixes them. The defaults resolve to the 1.0 values within ΔE2000 < 1, checked in a browser on every build, so a site that never touches the primary sees no change.

    data-iv-palette with a value points the primary of a subtree at another role of the theme: accent, success, warning, danger, info or neutral (the text colour on the page colour). The primary and the ink drawn on it change together, and every derived token follows — a danger zone in a settings page, a success panel, a monochrome footer, with one attribute and no new classes.

    Default cobalt, one variable, and data-iv-palette=&quot;success&quot;fixtures/theme/one-colour.htmlOpen alone — Default cobalt, one variable, and data-iv-palette=&quot;success&quot;
    <div class="iv-stack iv-u-gap-6">
      <p class="iv-u-m-0 iv-u-text-sm iv-u-text-muted">Sample controls: nothing here does anything. The three panels use the same markup. The first keeps the default cobalt; the second sets one variable, <code>--iv-color-primary</code> (and the text drawn on it), on a scope marked <code>data-iv-palette</code> — a rose mixed with the text colour of the theme, so it stays readable in light and dark; the third points the primary at the success role with <code>data-iv-palette="success"</code>. Hover states, tints, focus rings, glows and gradients are mixed from that one colour.</p>
    
      <div class="iv-grid iv-u-gap-4 iv-u-grid-cols-1 iv-u-lg-grid-cols-3">
        <section class="iv-card" aria-labelledby="oc-default">
          <div class="iv-card__body iv-stack iv-u-gap-4">
            <h3 class="iv-card__title" id="oc-default">Default cobalt</h3>
            <div class="iv-cluster">
              <button class="iv-button iv-button--primary" type="button">Deploy</button>
              <button class="iv-button iv-button--secondary" type="button">Preview</button>
            </div>
            <div class="iv-cluster">
              <span class="iv-badge iv-badge--primary">Beta</span>
              <span class="iv-badge iv-badge--solid iv-badge--primary">New</span>
              <a href="#oc-default">A text link</a>
            </div>
            <progress class="iv-progress" value="64" max="100" aria-label="Sample progress, 64 percent"></progress>
            <label class="iv-switch"><input type="checkbox" checked><span class="iv-switch__track" aria-hidden="true"><span class="iv-switch__thumb"></span></span>Auto deploy</label>
            <p class="iv-gradient-text iv-u-m-0 iv-u-text-xl iv-u-font-bold">Gradient text</p>
          </div>
        </section>
    
        <section class="iv-card" aria-labelledby="oc-custom" data-iv-palette style="--iv-color-primary: color-mix(in oklab, #E91E63 72%, var(--iv-color-text)); --iv-color-on-primary: var(--iv-color-bg)">
          <div class="iv-card__body iv-stack iv-u-gap-4">
            <h3 class="iv-card__title" id="oc-custom">One variable: rose</h3>
            <div class="iv-cluster">
              <button class="iv-button iv-button--primary" type="button">Deploy</button>
              <button class="iv-button iv-button--secondary" type="button">Preview</button>
            </div>
            <div class="iv-cluster">
              <span class="iv-badge iv-badge--primary">Beta</span>
              <span class="iv-badge iv-badge--solid iv-badge--primary">New</span>
              <a href="#oc-custom">A text link</a>
            </div>
            <progress class="iv-progress" value="64" max="100" aria-label="Sample progress, 64 percent"></progress>
            <label class="iv-switch"><input type="checkbox" checked><span class="iv-switch__track" aria-hidden="true"><span class="iv-switch__thumb"></span></span>Auto deploy</label>
            <p class="iv-gradient-text iv-u-m-0 iv-u-text-xl iv-u-font-bold">Gradient text</p>
          </div>
        </section>
    
        <section class="iv-card" aria-labelledby="oc-success" data-iv-palette="success">
          <div class="iv-card__body iv-stack iv-u-gap-4">
            <h3 class="iv-card__title" id="oc-success">Palette: success</h3>
            <div class="iv-cluster">
              <button class="iv-button iv-button--primary" type="button">Deploy</button>
              <button class="iv-button iv-button--secondary" type="button">Preview</button>
            </div>
            <div class="iv-cluster">
              <span class="iv-badge iv-badge--primary">Beta</span>
              <span class="iv-badge iv-badge--solid iv-badge--primary">New</span>
              <a href="#oc-success">A text link</a>
            </div>
            <progress class="iv-progress" value="64" max="100" aria-label="Sample progress, 64 percent"></progress>
            <label class="iv-switch"><input type="checkbox" checked><span class="iv-switch__track" aria-hidden="true"><span class="iv-switch__thumb"></span></span>Auto deploy</label>
            <p class="iv-gradient-text iv-u-m-0 iv-u-text-xl iv-u-font-bold">Gradient text</p>
          </div>
        </section>
      </div>
    </div>
    .iv-root {
      --iv-color-primary: color-mix(in oklab, #E91E63 72%, var(--iv-color-text));
      --iv-color-on-primary: var(--iv-color-bg);
    }

    --iv-color-on-primary, the colour of text drawn on the primary, is not derived: CSS in the browsers iVOLT supports cannot pick a contrasting colour. Set it with the primary and check the pair; the measured figures above show how much room each sample colour leaves. The recipes themselves are public tokens, one per derived value and per theme, in the form <colour> <percentage>; they can be tuned, and their values may be refined in a minor release:

    RecipeLightDark
    --iv-mix-primary-hoveroklab(0.0308 0.0244 -0.0642) 13%oklab(0.9857 -0.0058 0.0019) 27%
    --iv-mix-primary-activeoklab(0.0545 0.0176 -0.0069) 32%oklab(0.5901 -0.045 -0.218) 50%
    --iv-mix-primary-subtleoklab(0.9998 -0.0049 -0.0042) 93%transparent 88%
    --iv-mix-primary-bordertransparent 45%transparent 50%
    --iv-mix-focustransparent 0%var(--iv-color-accent) 100%
    --iv-mix-focus-halotransparent 65%transparent 68%
    --iv-mix-glow-primarytransparent 65%transparent 55%
    --iv-mix-glow-secondarytransparent 70%transparent 60%
    --iv-mix-brand-starttransparent 0%oklab(0.9983 -0.1379 0.0123) 42%
    --iv-mix-brand-endoklab(0.4576 0.1379 -0.1885) 20%oklab(0.1329 0.2574 -0.5042) 20%
    --iv-mix-gradient-startoklab(0.7927 -0.0692 -0.1693) 20%oklab(0.9994 -0.0912 0.0098) 50%
    --iv-mix-gradient-endoklab(0.4576 0.1379 -0.1885) 20%oklab(0.5621 0.2798 -0.2486) 20%

    A theme of your own can also change a recipe: --iv-mix-brand-end: var(--iv-color-accent) 35% ends both gradients a third of the way to your accent, which is what the presets of the theme gallery do.

    Themes

    data-iv-theme accepts light (default when absent), dark and system. Scopes nest and the nearest explicit value wins; system follows prefers-color-scheme without JavaScript or storage.

    Nested scopesfixtures/theme/nested.htmlOpen alone — Nested scopes
    <div class="iv-grid iv-u-gap-4 iv-u-grid-cols-1 iv-u-md-grid-cols-3">
      <section class="iv-card" data-iv-theme="light"><div class="iv-card__body"><h3 class="iv-card__title">Light scope</h3><button class="iv-button iv-button--primary" type="button">Primary</button></div></section>
      <section class="iv-card" data-iv-theme="dark"><div class="iv-card__body"><h3 class="iv-card__title">Dark scope</h3><button class="iv-button iv-button--primary" type="button">Primary</button>
        <section class="iv-card iv-u-mt-4" data-iv-theme="system"><div class="iv-card__body"><p class="iv-u-m-0">System inside dark follows the OS.</p></div></section>
      </div></section>
      <section class="iv-card" data-iv-theme="system"><div class="iv-card__body"><h3 class="iv-card__title">System scope</h3><button class="iv-button iv-button--primary" type="button">Primary</button></div></section>
    </div>

    The optional theme module adds getTheme(), setTheme(theme, { persist }), resolveTheme() and restoreTheme(), and dispatches iv:themechange on document. Persistence is opt-in. To avoid a flash before the stored theme applies, add a tiny inline script in <head>; with a strict CSP allow it by hash or nonce.

    Switching with a view transition

    New in 1.1 @intervolutions/ivolt/theme-transition exports setThemeWithTransition(theme, options): the same call as setTheme, wrapped in document.startViewTransition where the browser has it and the reader has not asked for less motion, so the page cross-fades between themes instead of flipping. Elsewhere it is setTheme as it was. It returns a promise of the resolved theme, fires iv:themechange once the browser has taken its snapshot, and throws an IvError synchronously for an invalid theme. It is a subpath of its own, so theme.js and the default bundle did not grow.

    import { setThemeWithTransition } from "@intervolutions/ivolt/theme-transition";
    button.addEventListener("click", () => setThemeWithTransition("dark", { persist: true }));

    Semantic colours

    TokenLightDark
    --iv-color-bg#FFFFFF#04070F
    --iv-color-surface#F5F7FC#070D1C
    --iv-color-surface-raised#FFFFFF#0C1330
    --iv-color-text#0B1230#EEF2FB
    --iv-color-text-muted#4F5B7A#A8B3CC
    --iv-color-border#D3DAEA#33406A
    --iv-color-border-strong#6B7896#6B7896
    --iv-color-primary#1D4FC4#66B1FF
    --iv-color-on-primary#FFFFFF#06122B
    --iv-color-primary-hover#1A3FA8#8FC6FF
    --iv-color-primary-active#172F7A#3D94FF
    --iv-color-primary-subtle#EAF4FFrgb(102 177 255 / 0.12)
    --iv-color-accent#0B6B8A#73DFFF
    --iv-color-on-accent#FFFFFF#06122B
    --iv-color-success#4F7A12#8BBF3A
    --iv-color-on-success#FFFFFF#06122B
    --iv-color-success-subtle#F1F8E4rgb(139 191 58 / 0.12)
    --iv-color-danger#C22E26#FF9AA4
    --iv-color-on-danger#FFFFFF#06122B
    --iv-color-danger-subtle#FFF1F0rgb(255 154 164 / 0.12)
    --iv-color-warning#8F5C00#FBBF24
    --iv-color-on-warning#FFFFFF#06122B
    --iv-color-warning-subtle#FFF8E6rgb(251 191 36 / 0.12)
    --iv-color-info#3D47C2#8B95FF
    --iv-color-on-info#FFFFFF#06122B
    --iv-color-info-subtle#EEF0FFrgb(139 149 255 / 0.12)
    --iv-color-focus#1D4FC4#73DFFF
    --iv-color-overlayrgb(11 18 48 / 0.55)rgb(2 5 12 / 0.78)
    --iv-color-hover-surfacergb(11 18 48 / 0.04)rgb(230 240 255 / 0.05)
    --iv-color-primary-borderrgb(29 79 196 / 0.55)rgb(102 177 255 / 0.5)

    Contrast targets: text 4.5:1, controls and focus 3:1 on their surfaces. The values above were checked against the WCAG formula; results are re-measured on each release.

    The expressive layer

    Six tokens added in v0.6. They name the recipes the polish pass had repeated by hand across a dozen modules — a shadow, a hover tint, a brand edge, a focus halo and two letter spacings — so every module now reads the same value from one place. Nothing changed visually when they landed: they are names for what was already drawn.

    TokenLightDarkWhere it is used
    --iv-shadow-ambient0 2px 10px rgb(11 18 48 / 0.10)0 0 1px 1px #1C2544, 0 2px 10px rgb(0 0 0 / 0.5)Resting elevation of card, wrapped table, alert, accordion and button. One token instead of five recipes.
    --iv-color-hover-surfacergb(11 18 48 / 0.04)rgb(230 240 255 / 0.05)Pointer tint on card, dialog and drawer footers, tabs and the picker field. Table and menu rows keep the brand tint of primary-subtle.
    --iv-color-primary-borderrgb(29 79 196 / 0.55)rgb(102 177 255 / 0.5)Brand outline: secondary button, field hover, pagination, and anywhere an edge should read as the brand.
    --iv-focus-halo0 0 2px 3px rgb(29 79 196 / 0.35)0 0 3px 2px rgb(102 177 255 / 0.32)The glow that accompanies the focus ring on fields, buttons, pagination, breadcrumbs, stepper markers and the navbar toggle. Always next to the outline, never instead of it.
    --iv-tracking-tight-0.011em-0.011emLetter spacing of card, dialog, drawer and stat titles.
    --iv-tracking-caps0.06em0.06emLetter spacing of small caps: table headers, fieldset legends, megamenu and palette headings, stat labels.

    The two colours also appear in the table above, because they are semantic colours like any other. All six are plain custom properties: override them on :root or on a scope and every component that reads them follows.

    Scales

    FamilyTokens
    Space--iv-space-0 … 16 (0.25rem steps up to 1.5rem, then 2, 2.5, 3, 4rem)
    Type--iv-text-xs … 4xl, --iv-leading-*, --iv-weight-*, --iv-font-sans|mono
    Shape--iv-radius-sm|md|lg|full, --iv-border-width, --iv-shadow-1|2|3
    Focus--iv-focus-width, --iv-focus-offset, --iv-color-focus
    Motion--iv-motion-fast|base|slow (120/180/220 ms; 0 ms under reduced motion), --iv-ease-out
    Layers--iv-z-dropdown|drawer|dialog|toast
    Measures--iv-measure (68ch), --iv-container-max (75rem), --iv-content-max (90rem)
    Breakpointssm 30em · md 48em · lg 64em · xl 80em · 2xl 90em. Resolved at build time; not available as custom properties inside media queries.