Getting started
Figma
Designers and developers should pick from the same palette. @nexub/tokens ships its tokens as Figma variables in the W3C Design Tokens format, built from the same values as the CSS and React Native tokens, so a Figma library made from them cannot drift from the code.
The files
| File | Becomes | Holds |
|---|---|---|
| color.<scheme>.<level>.tokens.json | Collection “Color”, one mode per file | Every colour role (primary, surface, on-surface…) and the four product brands, resolved to hex for light and dark at standard, medium and high contrast |
| primitives.tokens.json | Collection “Primitives” | Spacing, radius, shape, control and icon sizes, and the type scale (size, line height, weight, letter spacing) as numbers in px |
They are in the package at node_modules/@nexub/tokens/dist/figma/, or straight from npm:
Import into Figma
In your library file, open Local variables and choose Import variables.
Import
color.light.standard.tokens.jsonas a new collection named Color, then add each othercolor.*file as a mode of that collection (Dark, Light high contrast, and so on).Import
primitives.tokens.jsonas a second collection named Primitives.Bind your components to the role variables (
role/primary,role/on-surface…), never to hex. Switching a frame's mode then shows dark and high contrast exactly as the code renders them.
Using Tokens Studio instead? Load the same files as token sets, one set per mode.
Your own brand
For a white-label theme, build it in the theme builder and use its Tokens (DTCG) export, which uses the same format. Import its light and dark documents as a Brand collection and point the accent roles (primary or tertiary) at those variables.
What is next
@nexub/react code in Dev Mode) and an automated check that a Figma library still matches these tokens both need the Nexub Figma library file. They are planned once that library is published from these variables.