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
| File | Holds |
|---|---|
| core.tokens.json | Radius, spacing, heights, type, motion. The same in every mode. |
| color.light.tokens.json | Colour and shadow, light mode. |
| color.dark.tokens.json | Colour and shadow, dark mode. Same names as light, so tools treat the files as modes. |
| color.light-hc.tokens.json | Light mode in high contrast (data-contrast="more"): 7:1 text, 3:1 edges. |
| color.dark-hc.tokens.json | Dark mode in high contrast. |
- Holds
- Radius, spacing, heights, type, motion. The same in every mode.
- Holds
- Colour and shadow, light mode.
- Holds
- Colour and shadow, dark mode. Same names as light, so tools treat the files as modes.
- Holds
- Light mode in high contrast (data-contrast="more"): 7:1 text, 3:1 edges.
- Holds
- Dark mode in high contrast.
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
- 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 - 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).
- Export them to Figma variables, one collection with Light and Dark as modes. Component styles then bind to the variables, not to hex values.
- 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 regenerates the files. CI runs the check and fails when the JSON no longer matches the CSS.