Skip to content

Code output

One token source generates CSS, SwiftUI, Compose and Flutter. The same file is what a coding agent reads, so the name in the design and the name in the code are the same name.

On this page
  1. From variable to code
  2. Token source
  3. Languages
  4. Using the tokens
  5. Modes in code
  6. Coding agents

How does one variable become four languages?

Appetite UI holds its values once, as a token file, and generates the rest. One variable, four languages, no second copy to keep in step.

brand/base, from one variable to four generated names6 collections, 2 modes on color, 1 source file

Source, Color Tokens, Light

brand/base

aliases colors/blue/500

#155DFC

  • CSS

    var(--ap-brand-base)

  • SwiftUI

    Color.apBrandBase

  • Compose

    AppetiteTheme.colors.brandBase

  • Flutter

    apBrandBase

The export reads the first three names off the variable, which stores a code name for web, iOS and Android.

What is the token source?

One JSON file in the W3C Design Tokens format, run through Style Dictionary v5. Primitives hold the values. Semantic tokens point at primitives. Nothing holds a value twice.

The token filetwo entries, one reference
{
  "colors": {
    "blue": {
      "500": { "$type": "color", "$value": "#155DFC" }
    }
  },
  "brand": {
    "base": { "$type": "color", "$value": "{colors.blue.500}" }
  }
}
The source, collection, variables, modes
CollectionVariablesModes
Foundations202Default
Color Tokens190Light, Dark
Typography33Default
Motion31Default
Platform20ios-md, ios-lg, android, ios-duo-outer, ios-duo-inner
Platform Bridge113Brand, System

Figma writes a path with slashes, brand/base. The token file writes the same path with dots, so the reference reads {colors.blue.500}. Same token, two notations, and the export is where they meet.

The format is a public standard, so other design token tools can read the same values.

Which languages does the export produce?

Four outputs off the one source. These are examples of what the export produces, cut to three tokens so the four sit side by side: a color, a spacing step and a duration.

CSS custom propertiesweb
:root {
  --ap-brand-base: #155DFC;
  --ap-space-4: 16px;
  --ap-duration-fast: 120ms;
}
SwiftUIiOS
extension Color {
  static let apBrandBase = Color.apDynamic(
    light: Color(apHex: 0x155DFC),
    dark: Color(apHex: 0x2B7FFF))
}
enum AppetiteSpacing { static let space4: CGFloat = 16 }
enum AppetiteMotion { static let durationFast = 0.12 }
Jetpack ComposeAndroid
internal val BrandBase = Color(0xFF155DFC)
internal val Space4 = 16.dp
internal val DurationFast = 120

// read as AppetiteTheme.colors.brandBase
FlutterDart
const apBrandBase = Color(0xFF155DFC);
const apSpace4 = 16.0;
const apDurationFast = Duration(milliseconds: 120);

The file has no slot for Dart, so the export derives the Flutter names above. The other three are read off the variables.

The SwiftUI output emits Dynamic Type anchors for its text sizes, and the Compose output includes a ready Material 3 typography object. The Flutter output builds ThemeData for Light and Dark with AppetiteTheme.light() and AppetiteTheme.dark().

The source also carries the chart series colors, bg/raised, the glass tokens, the radius steps of 40 and 48, the Duo platform variables, and the heading family typography/fontFamily/Heading, Inter Display.

How do I use the tokens in my project?

Take the source and the four outputs that come with the file you buy, add the output for your platform to the project, and use the generated names. There is no package to install and no public repository.

  1. Take the source and the four outputs from the file you buy.

  2. Add the output for your platform to the project: the CSS file to a web build, the Swift file to an Xcode target, the Kotlin file to a Compose module, the Dart file to a Flutter package.

  3. Use the generated name: var(--ap-brand-base) in CSS, Color.apBrandBase in SwiftUI, AppetiteTheme.colors.brandBase in Compose and apBrandBase in Flutter.

  4. Change a value in the source, not in an output. The outputs are generated from the source with Style Dictionary v5, so an edit in an output file is lost at the next export.

The table gives the color and the spacing step of the samples above in each output.

Generated names, output, brand/base, spacing/4
Outputbrand/basespacing/4
CSSvar(--ap-brand-base)var(--ap-space-4)
SwiftUIColor.apBrandBaseAppetiteSpacing.space4
Jetpack ComposeAppetiteTheme.colors.brandBaseAppetiteTheme.spacing.space4
FlutterapBrandBaseapSpace4

How do modes reach the code?

A mode is a second value on the same token, in the same file. Light and Dark on color, Brand and System on the platform mirrors, five Platform modes on the platform metrics. One source carries all of them.

Modes, token, mode, resolves to, value
TokenModeResolves toValue
brand/baseLightcolors/blue/500#155DFC
brand/baseDarkcolors/blue/400#2B7FFF
text/on-color/strongLightstatic/static-white-0#FFFFFF
text/on-color/strongDarkstatic/static-white-0#FFFFFF
M3/sys/color/primaryBrandbrand/base#155DFC
M3/sys/color/primarySystemplatform/m3/primary#6750A4
platform/min-touch-targetios-md, ios-lg, ios-duo-outer, ios-duo-innerthe value itself44
platform/min-touch-targetandroidthe value itself48

The on-color tokens resolve to white in both modes. A label on a filled button keeps its color when the theme flips.

The last two rows are the minimum touch target: 44 pt on iOS and 48 dp on Android, read from one variable.

What the CSS export does with two modesone name, two values
:root {
  --ap-brand-base: #155DFC;
}

[data-theme="dark"],
.dark {
  --ap-brand-base: #2B7FFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not(.light) {
    --ap-brand-base: #2B7FFF;
  }
}

Can a coding agent read the design system?

Yes. The Appetite UI Core Skill is an instruction file included with your purchase. It teaches a coding agent which token and which pattern to use, so Claude, Cursor or anything else that reads project instructions works from the same source the export runs on.

What a variable says about itselfthree examples
brand/base
Primary buttons, active states, links. Maps to iOS tint and M3 primary.
border/soft-100
Hairline divider. Decorative separation only. Contrast 1.22:1, so never rely on it to convey structure.
typography/fontFamily/System
Platform face for operating system drawn surfaces. Never used by a text style, because no branded style should be able to reach it.

Those descriptions are carried on the variables themselves: the guidance travels with the value. Figma Code Connect maps one component to one snippet. An agent also has to know which token to reach for, and that is what the Core Skill supplies.