Skip to content
Design System
GitHub

Design tokens

The theme in a format any tool can read. Generated from syncrobotic-theme.css on every change, so design files, native apps and the web read the same values.

Files

Format: DTCG with string values (#09090b, 16px, 200ms), the form Tokens Studio and Style Dictionary 4 read. Colours that reference another token stay references ({color.foreground}).

Figma

  1. Install the Tokens Studio plugin and add a URL sync source for each file, e.g.https://design-system.syncrobotic.me/tokens/core.tokens.json
  2. Make two themes: Light (core + color.light) and Dark (core + color.dark), and two more for high contrast if the product goes outdoors (color.light-hc, color.dark-hc).
  3. Export them to Figma variables, one collection with Light and Dark as modes. Component styles then bind to the variables, not to hex values.
  4. When the theme changes, CI regenerates the files; pull in Tokens Studio to update the variables. Never edit tokens in Figma: change the CSS and let it flow.

Native apps

Copy the files into the app repo, or fetch them in its build, and generate platform code with Style Dictionary.

style-dictionary.config.mjs
// style-dictionary.config.mjs — e.g. Swift and Android resources for a native control app
export default {
  source: ["tokens/core.tokens.json", "tokens/color.dark.tokens.json"],
  platforms: {
    ios: { transformGroup: "ios-swift", buildPath: "ios/", files: [{ destination: "Tokens.swift", format: "ios-swift/class.swift" }] },
    android: { transformGroup: "android", buildPath: "android/", files: [{ destination: "tokens.xml", format: "android/resources" }] },
  },
}

Kept in step

npm run tokens regenerates the files. CI runs the check and fails when the JSON no longer matches the CSS.