Design Tokens Code Generator
Edit a tokens file with colours, spacing, fonts and shadows, check aliases and contrast, and export code for web, iOS and Android in one ZIP.
Работает в вашем браузере. Файлы никогда не покидают устройство. Как это проверить
…
Как пользоваться
- 1Open tokens
Press Open tokens JSON or edit the sample in JSON source.
- 2Review tokens
In Tokens check resolved values, previews and any red errors.
- 3Edit values
Change simple values directly in the table.
- 4Check contrast
Pick text and background colour tokens and read the WCAG result.
- 5Choose outputs
In Code output pick CSS, SCSS, Tailwind, Swift, Android or JSON and set prefix or names.
- 6Download
Copy one output, download it, or Download all as a ZIP.
Об этом инструменте
Design tokens are the named decisions of a design system (brand colours, spacing steps, radii, font families, shadows and motion timings) stored once in a JSON file and turned into code for each platform. This generator reads tokens in the W3C Design Tokens Community Group format, follows aliases such as {color.neutral.900}, shows every token with a swatch or preview and lets you edit values in a table. It then writes CSS custom properties, SCSS variables, a Tailwind v4 @theme block or v3 config, a SwiftUI enum and Android colors.xml and dimens.xml, individually or together in a ZIP.
Who it is for
Design system maintainers, front-end and mobile developers who need the same colours in three codebases, designers exporting from Figma Tokens Studio, and small teams starting a design system.
The token format
Each token has $value and usually $type (color, dimension, fontFamily, fontWeight, duration, shadow, cubicBezier or typography). Groups can set $type once for all children. Aliases point at another token with braces. Files from Style Dictionary or Tokens Studio that use value and type without the dollar sign also load. Colour objects with colorSpace and components and dimension objects with value and unit from the newer format are understood too.
Checks
The table shows each token's raw value, resolved value and a preview. Unknown references and circular aliases are reported in red and left out of the generated code, so a typo does not silently produce broken output. The contrast panel picks any two colour tokens and shows the WCAG ratio with AA and AAA results for normal and large text.
Outputs
- **CSS**: --prefix-color-brand-primary: #0ea5e9; under :root or a selector you choose, with descriptions as comments. - **SCSS**: $color-brand-primary: #0ea5e9; - **Tailwind**: a v4 @theme block (--color-*, --spacing-*, --radius-*, --font-*) and a v3 theme.extend config. - **iOS**: a SwiftUI enum with Color values in sRGB, CGFloat dimensions and TimeInterval durations. - **Android**: colors.xml in #AARRGGBB, dimens.xml in dp (sp for font sizes) and other values as integers or strings.
Worked example
The sample brand primary #0ea5e9 becomes --color-brand-primary: #0ea5e9 in CSS, Color(.sRGB, red: 0.055, green: 0.647, blue: 0.914, opacity: 1) in Swift and #FF0EA5E9 in Android. text.default is an alias of neutral.900 (#0f172a); on the white surface its contrast ratio is about 17.85:1, passing AAA.
Limits
Generated code follows simple naming rules (kebab case for CSS, camel case for Swift and snake case for Android) and converts rem at 16 px; adjust it if your platforms use other conventions. Themes and modes (for example light and dark sets) need separate files, and composite typography tokens are flattened to a CSS font shorthand. Check the output before publishing a new version of your design system.
Пример с решением
#0ea5e9 → --color-brand-primary (CSS), Color(.sRGB, 0.055, 0.647, 0.914) (Swift), #FF0EA5E9 (Android).
Коротко
- Категория: Разработка и данные
- Работает в браузере, без регистрации и загрузки.
- Введённые данные остаются на вашем устройстве.
- Доступно на английском.
- Содержание проверено:
- Официальный источник: W3C Design Tokens Community Group format (DTCG); WCAG 2.2 contrast ratio for the contrast check
Часто задаваемые вопросы
Which token format is supported?
The W3C Design Tokens Community Group format, plus value/type files from Style Dictionary and Tokens Studio.
Can it follow aliases?
Yes. References such as {color.neutral.900} are resolved, and unknown or circular ones are reported.
What do I get for Android?
colors.xml with #AARRGGBB values, dimens.xml in dp or sp, and a tokens.xml for numbers and strings.
Does it support Tailwind v4?
Yes, as an @theme block, and also a v3 tailwind.config.js theme.extend object.
Can I check colour contrast?
The contrast panel computes the WCAG ratio between any two colour tokens.
Is my design system uploaded?
No. Tokens are processed in your browser and saved only in its local storage.
