Filed underL07 · Design
Published
Reading time29 min
Updated
Field notes · L07 Design

Design tokens from Figma to web, iOS and AndroidA working pipeline

A design tokens pipeline from Figma variables to CSS, SwiftUI, Android XML and Compose, using DTCG 2025.10, Style Dictionary 5, CI and versioning.

The short answer

A working design tokens pipeline has four stages. Figma variables are where designers edit. A Git repo of DTCG-format JSON is the source of truth. Style Dictionary 5 turns that JSON into CSS custom properties, SwiftUI, Android resources and Compose. CI lints, builds and versions the output. Figma can now export and import variables as DTCG JSON on any plan that has modes, so you no longer need a plugin or an Enterprise contract to get tokens out. The hard parts are the layering rules, theme parity and deciding what counts as a breaking change. Tooling is not the hard part.

The rest of this post is a reference pipeline we've built and run end to end against Style Dictionary 5.6.0 on Node 22+. It covers the token format, how tokens get out of Figma, platform builds with dark mode, a governance linter, CI, and a semver policy for token changes.

01What changed: DTCG 2025.10 is stable, and Figma speaks it

Two things make now a good time to build this properly.

The format is stable. The Design Tokens Community Group published its first stable version, 2025.10, on 28 October 2025, as a Final Community Group Report. It has three modules:

  • Format covers the JSON structure, types, aliases and groups.
  • Color covers structured colour values with explicit colour spaces.
  • Resolver covers how sets and "modifiers" (light/dark, brand, density) combine into a final token set.

Be precise about what this is. It's a W3C Community Group report, not a W3C Recommendation. In practice that doesn't matter much. What matters is that Figma, Style Dictionary and Terrazzo now target the same document. A draft of the next revision already exists, and it is explicitly marked not for implementation. Pin to 2025.10.

Figma imports and exports DTCG. Right-click a mode and choose Export mode, or right-click a collection and choose Export modes. Importing a DTCG file creates a mode per file. Figma's documented mapping is narrow, and you should design around it:

DTCG type Figma variable type Constraint
color Color sRGB and HSL only
dimension Number Unit must be px
fontFamily String Single family name only
duration Number Unit must be s
number Number or Boolean Boolean via com.figma.type: "boolean" extension
(non-standard) String Accepted on import

Cross-collection aliases travel in a com.figma.aliasData extension. Composite types such as typography, shadow and border have no variable equivalent. They live in Figma styles. More on that below.

02The token format you should actually write

The 2025.10 format module defines a small set of reserved properties. You need $value and $type, and you will use $description, $deprecated and $extensions. There is also $extends for group inheritance and $root for a group's base value. A group's $type is inherited by every token beneath it. Token and group names may not start with $ or contain {, } or ., because those characters belong to the alias syntax.

The two changes from older "DTCG-ish" files that break naive pipelines are structured colours and structured dimensions:

json
{
  "color": {
    "$type": "color",
    "blue": {
      "600": { "$value": { "colorSpace": "srgb", "components": [0.145, 0.388, 0.922], "hex": "#2563eb" } },
      "400": { "$value": { "colorSpace": "srgb", "components": [0.376, 0.647, 0.98],  "hex": "#60a5fa" } }
    },
    "neutral": {
      "0":   { "$value": { "colorSpace": "srgb", "components": [1, 1, 1], "hex": "#ffffff" } },
      "900": { "$value": { "colorSpace": "srgb", "components": [0.067, 0.094, 0.153], "hex": "#111827" } },
      "950": { "$value": { "colorSpace": "srgb", "components": [0.012, 0.027, 0.071], "hex": "#030712" } }
    }
  },
  "space": {
    "$type": "dimension",
    "100": { "$value": { "value": 4,  "unit": "px" } },
    "200": { "$value": { "value": 8,  "unit": "px" } },
    "400": { "$value": { "value": 16, "unit": "px" } }
  }
}

A colour is { colorSpace, components, alpha?, hex? }. A dimension is { value, unit }, and the only permitted units are px and rem. Aliases use curly braces ("{color.blue.600}") to reference a whole token. 2025.10 also adds JSON Pointer $ref for reaching into part of a value. Media type is application/design-tokens+json, and the extensions are .tokens or .tokens.json.

Our advice: author in px. Figma only round-trips px. iOS points and Android dp are both density-independent units that map 1:1 to CSS px at the reference density. rem buys you user font scaling on the web, and you can get that in the web transform without polluting the source.

Primitive, semantic, component: how many tiers you need

Every serious token system ends up with tiers:

  1. Primitives are raw values with no meaning: color.blue.600 and space.400. They are the palette.
  2. Semantic tokens are named for intent and alias primitives: surface.default, text.default, action.primary. Themes live here. Light and dark are two different alias maps over the same primitives.
  3. Component tokens belong to a component: button.primary.background.

You probably don't need tier 3. Component tokens multiply quickly and mostly restate semantic tokens one-to-one. Add one only when a component must diverge from the semantic layer, for example a button that keeps brand colour in dark mode when every other action.* token shifts. Two tiers with strict rules beat three tiers without them.

The rules that make tiers worth having:

  • Primitives contain raw values only and never alias.
  • Semantic tokens alias primitives only and never contain raw values.
  • Every theme defines exactly the same set of semantic tokens.
  • Application code consumes semantic tokens only.

None of those rules is enforced by Figma or by Style Dictionary. We enforce them in CI with a 75-line linter, shown later.

03Getting tokens out of Figma: four options

This is the decision that shapes everything else. There are four realistic sync patterns:

Native export/import Variables REST API Tokens Studio plugin Code-first
Source of truth Figma, exported by hand Figma, pulled on a schedule Plugin JSON in Git Git
Plan needed Any plan with modes (Professional: 10 modes/collection, Organization: 20) Enterprise, Full seat Free plugin syncs to Git; branch switching and multi-file sync need Pro Any
Automation Manual export, then PR Fully automatic PR Plugin pushes branch/PR Push to Figma via import or API
Format DTCG 2025.10 colour objects Figma's own JSON, so you write a converter DTCG $value/$type keys, but colours stay strings, not 2025.10 colour objects DTCG
Composite types No No (variables only) Yes (typography, shadow) Yes in code, not in Figma variables
Best for Most teams Large orgs already on Enterprise Teams that want composites in Figma Engineering-led systems, multi-brand

Plan limits come from Figma's plan comparison. Enterprise gets unlimited modes through extended collections. Each collection holds up to 5,000 variables.

What we'd do. Start with native export into a PR. It's free, the output is spec-shaped, and a human looking at a diff is the right control for a change that alters every screen in every app. Move to the REST API only when export frequency makes manual work painful and you're already on Enterprise. Figma maintains a reference repo for two-way sync with GitHub Actions. Note that it expects one token file per collection and mode, and that its format deviates from the spec in places. Go code-first when engineers own the system or you have more than one brand. Then Figma becomes a consumer, fed by importing the generated DTCG files.

Whichever you pick, never let two places be writable at once without a merge step. Two-way sync that matches by name, which is how the Figma example works, will happily overwrite a rename on one side with stale data from the other.

Normalising what Figma exports

Figma variables have no dimension type. Spacing and radius are Number variables. Figma imports a px dimension as a Number variable, but its docs don't say which $type comes back on export. Check your exported files: if spacing and radius arrive as a unitless number where your platforms need a dimension, fix it once, at the boundary, with a Style Dictionary preprocessor. Don't fix it in every platform transform:

js
// If Figma exports spacing/radius as unitless numbers, make them DTCG px dimensions.
const PX_GROUPS = new Set(['space', 'radius', 'size']);

StyleDictionary.registerPreprocessor({
  name: 'figma/numbers-to-px',
  preprocessor: (tokens) => {
    const walk = (node, path) => {
      for (const [k, v] of Object.entries(node)) {
        if (k.startsWith('$') || typeof v !== 'object') continue;
        if ('$value' in v) {
          if (PX_GROUPS.has(path[0] ?? k) && typeof v.$value === 'number') {
            v.$type = 'dimension';
            v.$value = { value: v.$value, unit: 'px' };
          }
        } else walk(v, [...path, k]);
      }
    };
    walk(tokens, []);
    return tokens;
  },
});
// then: new StyleDictionary({ ..., preprocessors: ['figma/numbers-to-px'] })

Keep the exported files byte-for-byte as Figma produced them under tokens/. Do normalisation in the build. That way every future export produces a clean diff.

04The pipeline end to end

Export modes / REST API

Figma variables
collections × modes

Pull request
tokens/*.tokens.json

lint-tokens.mjs
layering · parity · contrast

Style Dictionary 5
build.mjs

dist/web
CSS

dist/ios
Swift

dist/android
XML

dist/compose
Kotlin

Release
npm · SwiftPM tag · Maven

Fig. 1 · The pipeline end to end

Repository layout:

Text
tokens/
  primitive/
    color.tokens.json
    space.tokens.json
  semantic/
    light.tokens.json
    dark.tokens.json
build.mjs          # Style Dictionary config
formats.mjs        # custom themed formats for Swift and Compose
lint-tokens.mjs    # governance checks
dist/              # generated, committed (see "Should generated files be committed")

The semantic files are short and readable, which is the point:

json
{
  "surface": { "$type": "color", "default": { "$value": "{color.neutral.0}", "$description": "Page and card background" } },
  "text":    { "$type": "color", "default": { "$value": "{color.neutral.900}" } },
  "action":  { "$type": "color", "primary": { "$value": "{color.blue.600}" } }
}

dark.tokens.json has the same keys aliased to neutral.950, neutral.0 and blue.400.

05Style Dictionary 5 configuration for web, iOS and Android

Style Dictionary has supported DTCG since v4. The current release is 5.6.0 (3 October 2026, per npm), and it requires Node 22 or later. Its own docs say 2025.10 support is "a work in progress in v5". We read the 5.6.0 source to see what that means in practice. The built-in colour transforms (color/css, color/hex8android, color/ColorSwiftUI, color/composeColor) do understand { colorSpace, components } objects. Dimension handling understands { value, unit }. There is no support for resolver documents, $ref or $extends. Model themes as a build loop instead, which is what Style Dictionary has always done.

Two built-in behaviours bite on native platforms. The stock ios-swift and compose transform groups assume your sizes are in rem (size/remToCGFloat, size/compose/remToDp). If you author in px, they multiply by 16 and your 8px radius becomes 128. So we register three small dimension transforms and fail loudly on anything that isn't px:

js
// build.mjs — Style Dictionary 5.x, DTCG input, light + dark
import StyleDictionary from 'style-dictionary';
import './formats.mjs';

const THEMES = ['light', 'dark'];
const isPrimitive = (t) => t.filePath.includes('/primitive/');
const isSemantic = (t) => !isPrimitive(t);

// DTCG dimensions are { value, unit }. Native platforms want bare numbers.
const pxOnly = (t) => {
  const v = t.$value;
  if (v?.unit !== 'px') throw new Error(`${t.name}: native targets need px, got ${JSON.stringify(v)}`);
  return v.value;
};
StyleDictionary.registerTransform({
  name: 'size/swiftCGFloat', type: 'value',
  filter: (t) => t.$type === 'dimension',
  transform: (t) => `CGFloat(${pxOnly(t)})`,
});
StyleDictionary.registerTransform({
  name: 'size/androidDp', type: 'value',
  filter: (t) => t.$type === 'dimension',
  transform: (t) => `${pxOnly(t)}dp`,
});
StyleDictionary.registerTransform({
  name: 'size/composeDp', type: 'value',
  filter: (t) => t.$type === 'dimension',
  transform: (t) => `${pxOnly(t)}.dp`,
});

const pascal = (s) => s[0].toUpperCase() + s.slice(1);

function config(theme) {
  const T = pascal(theme);
  const first = theme === THEMES[0]; // emit primitives once
  return {
    source: ['tokens/primitive/**/*.tokens.json', `tokens/semantic/${theme}.tokens.json`],
    usesDtcg: true,
    log: { verbosity: 'verbose', warnings: 'error' },
    platforms: {
      css: {
        transformGroup: 'css',
        buildPath: 'dist/web/',
        // Semantic files deliberately reference primitives.css; silence only this platform.
        log: { warnings: 'disabled' },
        files: [
          ...(first ? [{ destination: 'primitives.css', format: 'css/variables', filter: isPrimitive }] : []),
          {
            destination: `${theme}.css`,
            format: 'css/variables',
            filter: isSemantic,
            options: {
              selector: first ? ':root, [data-theme="light"]' : `[data-theme="${theme}"]`,
              outputReferences: true,
            },
          },
        ],
      },
      ios: {
        transforms: ['attribute/cti', 'name/camel', 'color/ColorSwiftUI', 'size/swiftCGFloat'],
        buildPath: 'dist/ios/',
        files: [
          {
            destination: `Tokens${T}.swift`,
            format: 'ios-swift/enum.swift',
            filter: first ? undefined : isSemantic,
            options: { className: `Tokens${T}`, import: ['SwiftUI'] },
          },
          ...(first ? [{ destination: 'Theme.swift', format: 'ios-swift/themed' }] : []),
        ],
      },
      android: {
        transforms: ['attribute/cti', 'name/snake', 'color/hex8android', 'size/androidDp'],
        buildPath: `dist/android/res/${first ? 'values' : 'values-night'}/`,
        files: [
          { destination: 'colors.xml', format: 'android/colors',
            filter: (t) => t.$type === 'color' && (first || isSemantic(t)) },
          ...(first ? [{ destination: 'dimens.xml', format: 'android/dimens',
            filter: (t) => t.$type === 'dimension' }] : []),
        ],
      },
      compose: {
        transforms: ['attribute/cti', 'name/camel', 'color/composeColor', 'size/composeDp'],
        buildPath: 'dist/compose/',
        files: [
          {
            destination: `Tokens${T}.kt`,
            format: 'compose/object',
            filter: first ? undefined : isSemantic,
            options: { className: `Tokens${T}`, packageName: 'com.example.tokens' },
          },
          {
            destination: `${T}SemanticColors.kt`,
            format: 'compose/semantic-colors',
            options: { packageName: 'com.example.tokens', instanceName: `${T}SemanticColors`, emitClass: first },
          },
        ],
      },
    },
  };
}

for (const theme of THEMES) {
  await new StyleDictionary(config(theme)).buildAllPlatforms();
}

A few deliberate choices in there:

  • warnings: 'error' globally. Token name collisions are always a bug. Two tokens that both become --space-100 after kebab-casing is exactly the kind of thing you want to fail a PR. The single exception is the CSS platform. There, semantic files reference primitives defined in a different file on purpose, which trips Style Dictionary's "filtered out token references" warning.
  • outputReferences: true on the web only. --surface-default: var(--color-neutral-0) keeps the alias visible in DevTools. Native outputs resolve to literals, because Swift and Kotlin constants gain nothing from the indirection.
  • Primitives are emitted once. The dark build only emits semantic tokens.

06Dark mode and theming on each platform

The web output is three files:

css
/* primitives.css */
:root {
  --color-blue-400: #60a5fa;
  --color-blue-600: #2563eb;
  --color-neutral-0: #ffffff;
  --color-neutral-900: #111827;
  --color-neutral-950: #030712;
  --space-100: 4px;
  --space-200: 8px;
  --space-400: 16px;
  --radius-md: 8px;
}
/* light.css */
:root, [data-theme="light"] {
  --surface-default: var(--color-neutral-0); /** Page and card background */
  --text-default: var(--color-neutral-900);
  --action-primary: var(--color-blue-600);
}
/* dark.css */
[data-theme="dark"] {
  --surface-default: var(--color-neutral-950); /** Page and card background */
  --text-default: var(--color-neutral-0);
  --action-primary: var(--color-blue-400);
}

The stock css/variables format can't wrap output in @media (prefers-color-scheme: dark). Set data-theme on <html> from a tiny inline script before first paint, so there's no flash, or write a custom format that emits the media query. We prefer the attribute. It gives you an explicit user override for free.

Android gets the most native result, because resource qualifiers already solve theming. The dark build writes the same colour names into res/values-night/colors.xml, and the OS picks the right one:

xml
<!-- values-night/colors.xml -->
<resources>
  <color name="surface_default">#ff030712</color>
  <color name="text_default">#ffffffff</color>
  <color name="action_primary">#ff60a5fa</color>
</resources>

iOS and Compose need a little help. Two parallel TokensLight and TokensDark enums are correct but useless on their own, because every call site would have to branch. So formats.mjs registers two small custom formats that generate the themed layer as well:

js
// formats.mjs (excerpt)
const semanticColors = (dictionary) =>
  dictionary.allTokens.filter((t) => t.$type === 'color' && !t.filePath.includes('/primitive/'));

StyleDictionary.registerFormat({
  name: 'ios-swift/themed',
  format: ({ dictionary }) => `// Do not edit directly, this file was auto-generated.
import SwiftUI
import UIKit

private func themed(_ light: Color, _ dark: Color) -> Color {
    Color(UIColor { $0.userInterfaceStyle == .dark ? UIColor(dark) : UIColor(light) })
}

public enum Theme {
${semanticColors(dictionary)
  .map((t) => `    public static let ${t.name} = themed(TokensLight.${t.name}, TokensDark.${t.name})`)
  .join('\n')}
}
`,
});

That produces Theme.surfaceDefault, a dynamic Color resolved from the trait collection, so SwiftUI views just write .background(Theme.surfaceDefault). The Compose format emits an @Immutable data class SemanticColors plus LightSemanticColors and DarkSemanticColors instances. You then provide one through a CompositionLocal chosen by isSystemInDarkTheme(). If you already map onto Material 3's ColorScheme, generate lightColorScheme(...) arguments instead and skip the custom class.

An alternative on iOS is to generate an asset catalogue (Colors.xcassets with Any/Dark appearances). It works well with UIKit and Interface Builder, but it's more files to generate and harder to diff in review. Use it if you have a large UIKit surface. Otherwise the generated Theme enum is simpler.

Typography and other composite tokens

DTCG 2025.10 defines typography, shadow, border, transition, gradient and strokeStyle as composite types. Figma variables can't hold any of them. Figma text and effect styles can bind individual properties to variables, so the practical split is:

  • Put the atoms in variables and the DTCG primitive files: font.family.sans, font.size.300, font.weight.semibold, line-height.300.
  • Define composites in code: a typography.body token whose sub-values alias the atoms. Mirror them as Figma text styles bound to those variables.

Style Dictionary's CSS group already ships typography/css/shorthand and shadow/css/shorthand. For native platforms, write a format that emits a Font/TextStyle per typography token. Line height is where platforms disagree most: CSS uses a ratio or a length, iOS uses line spacing, and Compose uses lineHeight in sp. Decide your source unit, document it in $description, and convert in one place.

07Governance: a linter for the rules Style Dictionary doesn't check

This is the part most token pipelines skip. Style Dictionary will build whatever you give it. It won't tell you that a designer typed a raw hex into a semantic token, that dark mode is missing three tokens, or that the new dark text.default is unreadable. This script does. It has no dependencies and needs Node 22+ for fs.globSync:

js
// lint-tokens.mjs — governance checks that Style Dictionary does not do for you.
// Usage: node lint-tokens.mjs   (exit 1 on any violation)
import { readFileSync, globSync } from 'node:fs';

const THEMES = ['light', 'dark'];
// Pairs that must meet WCAG 2.2 contrast in every theme: [foreground, background, minRatio]
const CONTRAST = [
  ['text.default', 'surface.default', 4.5],
  ['action.primary', 'surface.default', 3],
];

const errors = [];
const load = (f) => JSON.parse(readFileSync(f, 'utf8'));

// Flatten a DTCG tree into Map<path, token>, applying group $type inheritance.
function flatten(node, path = [], type, out = new Map()) {
  const t = node.$type ?? type;
  if ('$value' in node) return out.set(path.join('.'), { ...node, $type: t });
  for (const [k, v] of Object.entries(node)) {
    if (k.startsWith('$')) continue;
    if (k.includes('.') || k.includes('{') || k.includes('}')) errors.push(`illegal name: ${[...path, k].join('.')}`);
    flatten(v, [...path, k], t, out);
  }
  return out;
}

const primitives = new Map();
for (const f of globSync('tokens/primitive/**/*.tokens.json')) {
  for (const [k, v] of flatten(load(f))) primitives.set(k, v);
}
const themes = Object.fromEntries(
  THEMES.map((th) => [th, flatten(load(`tokens/semantic/${th}.tokens.json`))]),
);

const ALIAS = /^\{([^{}]+)\}$/;

// 1. Primitives hold raw values only; semantics hold aliases to primitives only.
for (const [k, v] of primitives) {
  if (typeof v.$value === 'string' && ALIAS.test(v.$value)) errors.push(`primitive ${k} is an alias`);
}
for (const [th, map] of Object.entries(themes)) {
  for (const [k, v] of map) {
    const m = typeof v.$value === 'string' && v.$value.match(ALIAS);
    if (!m) { errors.push(`[${th}] ${k}: raw value in semantic layer`); continue; }
    if (!primitives.has(m[1])) errors.push(`[${th}] ${k}: alias {${m[1]}} is not a primitive`);
    else if (primitives.get(m[1]).$type !== v.$type) errors.push(`[${th}] ${k}: type mismatch with {${m[1]}}`);
  }
}

// 2. Every theme defines exactly the same semantic tokens.
const [base, ...rest] = THEMES;
for (const th of rest) {
  for (const k of themes[base].keys()) if (!themes[th].has(k)) errors.push(`[${th}] missing ${k}`);
  for (const k of themes[th].keys()) if (!themes[base].has(k)) errors.push(`[${th}] extra ${k}`);
}

// 3. Contrast (sRGB only; WCAG 2.x relative luminance).
const lin = (c) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
const lum = ({ colorSpace, components }) => {
  if (colorSpace !== 'srgb') throw new Error(`contrast check supports srgb only, got ${colorSpace}`);
  const [r, g, b] = components.map(lin);
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
};
const resolve = (map, k) => primitives.get(map.get(k).$value.match(ALIAS)[1]).$value;
for (const [th, map] of Object.entries(themes)) {
  for (const [fg, bg, min] of CONTRAST) {
    if (!map.has(fg) || !map.has(bg)) continue; // reported by parity check
    const [a, b] = [lum(resolve(map, fg)), lum(resolve(map, bg))].sort((x, y) => y - x);
    const ratio = (a + 0.05) / (b + 0.05);
    if (ratio < min) errors.push(`[${th}] ${fg} on ${bg}: ${ratio.toFixed(2)}:1 < ${min}:1`);
  }
}

if (errors.length) { console.error(errors.map((e) => `✕ ${e}`).join('\n')); process.exit(1); }
console.log(`tokens ok: ${primitives.size} primitives, ${themes[base].size} semantic × ${THEMES.length} themes`);

The thresholds are the WCAG 2.2 minimums: 4.5:1 for body text (1.4.3) and 3:1 for UI components (1.4.11). The luminance maths is WCAG's own definition. Here is what it catches when someone pastes a hex into dark mode, deletes a token and aliases text to the wrong neutral:

Text
✕ [dark] action.primary: raw value in semantic layer
✕ [dark] missing surface.default
✕ [dark] text.default on surface.default: 1.14:1 < 4.5:1

The contrast check is deliberately sRGB-only and throws on anything else. If you adopt oklch or Display P3 primitives, add a colour library such as Color.js rather than extending the hand-rolled maths. A wrong contrast ratio that looks right is worse than no check.

08CI: lint, build, verify, release

yaml
# .github/workflows/tokens.yml
name: tokens
on:
  pull_request:
    paths: ['tokens/**', '*.mjs', 'package*.json']
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: node lint-tokens.mjs
      - run: node build.mjs
      - name: Generated output is committed and current
        run: git diff --exit-code -- dist/ || { echo "::error::dist/ is stale. Run 'node build.mjs' and commit."; exit 1; }

Pin style-dictionary exactly ("style-dictionary": "5.6.0", not ^5). A minor release that changes how a colour rounds will change every generated file. You want that in its own reviewable PR, not mixed into someone's token change. For third-party actions, pin to commit SHAs. Our post on hardening GitHub Actions with OIDC and pinned SHAs covers why and how.

Two more checks are worth adding once the basics hold:

  • Compile the outputs. Run swiftc -parse on a macOS runner and a Gradle compile of the Compose module. A token named default or class produces a Swift or Kotlin keyword collision that only a compiler will catch.
  • Post a token diff on the PR. Resolve both branches' tokens to flat path → value maps and comment a table of added, removed and changed tokens. Better still, render the changed colours as swatches. Reviewers can't judge components: [0.145, 0.388, 0.922] by eye.

Should generated files be committed?

Normally, no. Here, yes. Swift Package Manager resolves packages from Git tags and needs the sources in the repo at that tag. Committing dist/ also makes the PR diff show exactly what each platform will receive, which is the most useful review artefact you have. The git diff --exit-code step keeps the committed output honest. For a web-only system that publishes to npm, keep dist/ out of Git and build in the release job.

09Reference: token change classification and versioning policy

This is the table we'd put in the repo's CONTRIBUTING.md. Version the token package with semver, where the "API" is the set of token names and their types. Values are not part of the API, but they are part of the product, so they get their own review gate.

Change Example Semver Required in PR Notes
Add primitive color.teal.500 minor – Unused primitives are fine; lint for orphaned ones quarterly
Add semantic token surface.raised minor Value in every theme Parity check enforces it
Change semantic alias action.primary → blue.700 minor Design sign-off, swatch diff Visual change, not an API break
Change primitive value blue.600 hex tweak minor Design sign-off, contrast passes Affects every semantic alias, so list them in the PR
Deprecate token "$deprecated": "Use surface.default" minor Replacement named in message Keep at least one minor release before removal
Rename token bg.default → surface.default major Deprecated alias kept for one minor Ship old name as alias to new, then remove
Remove token text.inverse major Was deprecated in a previous release Grep consuming repos first
Change token type number → dimension major Migration note Changes generated code signatures
Add theme/mode high-contrast minor Full parity + contrast New file, new selector, new values-* qualifier
Remove theme/mode drop dim major – –
Toolchain bump changes output Style Dictionary 5.6 → 5.7 patch Own PR, no token changes mixed in If output changes visibly, treat as minor

The rename row is the one teams get wrong. Rename in two releases, the same shape as an expand/contract migration on a database schema. First, ship the new name and keep the old one as { "$value": "{surface.default}", "$deprecated": "Renamed to surface.default" }. Style Dictionary passes $deprecated through to formats, so you can emit @available(*, deprecated) in Swift or @Deprecated in Kotlin with a custom format. None of the built-in formats in 5.6.0 emit deprecation annotations, so the custom format is required. Remove the old name in the next major.

Releases: use Changesets or a tag-driven job to publish @yourco/tokens to npm, tag the repo for SwiftPM, and publish an AAR or source set for Android. Release all platforms from one tag. Never let iOS run a different token version from web. If consumers need to verify what they install, SBOMs and Sigstore signing in the CI pipeline fit into the same release job.

10Multi-brand and the resolver module

Themes multiply. Three brands × light/dark × four platform targets is 3 × 2 × 4 = 24 generated output sets. That's a worked count, not a benchmark, and it's why multi-brand systems outgrow the simple for (const theme of THEMES) loop.

The 2025.10 resolver module standardises this. A .resolver.json document declares base sets, modifiers with named contexts, and a resolutionOrder where later entries override earlier ones:

json
"modifiers": {
  "theme": {
    "description": "Color theme",
    "contexts": {
      "light": [{ "$ref": "theme/light.json" }],
      "dark": [{ "$ref": "theme/dark.json" }]
    },
    "default": "light"
  }
}

A tool given { "theme": "dark", "brand": "acme" } produces one resolved token set. As of 5.6.0, Style Dictionary doesn't read resolver documents. Terrazzo's 2.0 release notes claim full support for DTCG 2025.10, including resolvers, though later 2.x releases are still fixing resolver bugs, so test it against your own resolver document. Terrazzo has a Swift plugin but no first-party Android plugin. Our view: with one brand, keep the loop. With several brands, write the resolver document anyway, because it's the clearest statement of how your themes compose. Then either use a tool that reads it or generate your Style Dictionary configs from it with a 30-line script. In Figma, multi-brand maps to extended collections on Enterprise.

11Failure modes we see in token pipelines

  • The rem multiplication bug. Authoring in px while using stock ios-swift/compose transform groups gives 16× sizes on native. The pxOnly guard above turns this into a build error.
  • Silent alias breakage. A designer renames blue/600 in Figma. The export now has brand/600, and every semantic alias pointing at {color.blue.600} fails to resolve. Style Dictionary does throw on unresolvable references, which is good, but the fix belongs in Figma. Lock primitive renames behind the same review as API changes.
  • Theme drift. Someone adds surface.raised to light only. Web silently keeps the light value (the :root rule still matches), Android falls back to the values/ colour (light) in dark mode, and iOS fails to compile. Three different bugs from one omission. The parity check prevents all three.
  • Two writable sources. Engineers hot-fix a value in JSON while designers change it in Figma. The next export reverts the hot-fix. Pick one writable source per token tier.
  • Tokens nobody uses. Hundreds of component tokens, half orphaned. It's the token equivalent of feature flag debt. Run a quarterly grep of consuming repos for each generated name, and deprecate anything with zero hits.
  • Over-tokenising. Not every value deserves a token. A one-off illustration colour or a bespoke marketing layout spacing should stay local. Tokens are for decisions you want repeated.

12Where this crosses into the rest of the stack

Tokens look like a design concern, but the pipeline above is mostly software and delivery work. It needs a package-publishing strategy across npm, SwiftPM and Maven. It needs CI that people trust enough to gate releases on. It needs a Figma access token with the narrowest scope (file_variables:read) stored as a CI secret and rotated. And WCAG contrast is a compliance requirement, not a preference. When one team owns design and another owns delivery, tokens are often where the gap shows: a system that looks finished in Figma and drifts in every app. Treating the token repo as a product, with an owner, a changelog and a versioning policy, closes most of that gap. The same semantic tokens should also cover newer surfaces, such as the pending, streaming and error states in AI UX patterns for streaming and latency.

13FAQ

Is the DTCG design tokens format a W3C standard?

No. 2025.10 is a Final Community Group Report from the W3C Design Tokens Community Group, not a W3C Recommendation. It is stable and versioned, and Figma, Style Dictionary and Terrazzo implement it, so it's safe to build on. Pin to 2025.10 rather than the editor's draft.

Do I still need Tokens Studio now that Figma exports DTCG natively?

Probably not, if you only need colour, number, string and boolean variables. Native export gives you spec-shaped JSON on any plan with modes. Tokens Studio still earns its place if designers need composite tokens (typography, shadows) authored in Figma, or a Git-sync workflow without an Enterprise plan.

Should Figma or code be the source of truth for design tokens?

Choose one writable source per tier, and record the choice in an architecture decision record, because it's expensive to reverse. For most teams, designers edit primitives and semantic aliases in Figma, and Git is the reviewed source of truth that every build reads from. Choose code-first when engineers own the system, when you have several brands, or when you depend on composite tokens that Figma variables can't represent.

Can Style Dictionary read Figma's exported JSON directly?

Mostly, yes. Set usesDtcg: true, and Style Dictionary 5 parses DTCG colour objects and { value, unit } dimensions. Add a preprocessor to turn unitless spacing numbers into px dimensions, and ignore the com.figma.* extensions. Resolver documents, $ref and $extends aren't supported as of 5.6.0.

How should dark mode tokens work on Android and iOS?

On Android, write dark values to res/values-night/ with the same resource names, and the OS switches for you. On iOS, generate a dynamic Color per semantic token that resolves from userInterfaceStyle, or generate an asset catalogue with Any/Dark appearances. In Compose, generate light and dark instances of one colour class and provide the active one through a CompositionLocal.

What counts as a breaking change in a design token package?

Removing, renaming or retyping a token is breaking, so it's a major version. Adding tokens or changing values is a minor version: it's visual, not an API change, but it needs design sign-off and must pass contrast checks. Always deprecate with $deprecated for at least one minor release before removing anything.

If this is the layer that hurts, we should talk.

Tell us which layer hurts →