Skip to content
Onefold
Get startedPlaygroundDocumentation

Design to code

Move a theme by hand

Figma, the token names, the CSS variables, and the JSON describe the same theme. Nothing syncs them for you.

Where a developer starts

Handoff stays manual. Copy src/design-system and download the CSS and JSON on this page. There is no automated Figma-to-code sync. The repository a developer clones, and the running studio, are named in the case study handoff.

Core contract

A theme is configured with primary, accent, and radius, plus type and neutrals. The current project is Blue app. Primary #1035A3. Accent #0E80F2. Radius 14px. The export also writes the supporting surface and status values. It does not write a separate component-token file.

  1. 1

    Configure the theme here

    Open Customize. Pick Blue app, Shop, Health notes, or Editorial, or set your own primary, accent, type, neutrals, and radius. This page exports whatever is in the editor.

  2. 2

    Download the theme file

    The CSS file is what the other app reads. Variables include --primary, --accent, --gradient, --button-background, --radius, and --ring. --ring matches accent. The JSON file uses the same token names. Commit both with the project. This is a download, not a sync.

  3. 3

    Put the components in the other app

    Copy the folder src/design-system into the other app. Paste the CSS into the app. Then a button is:

    import { Button } from "@/design-system";
    
    export function NewTask() {
      return <Button>New task</Button>;
    }

Registry and the local script

/registry is JSON built from the component catalog and the four presets. Each component includes a playground flag when the playground can edit a real prop. The same catalog feeds a script that lives in this repository. Run it from the repo root. It is not a package, and there is nothing to install.

npm run onefold -- list
npm run onefold -- tokens grove
npm run onefold -- registry

list prints slug, name, and summary. tokens prints light and dark values for one theme: sable, kiln, grove, or ink. registry prints the same JSON as /registry. CSS and JSON for the theme in use are the download buttons above. Nothing here calls a model.

Figma foundations and components

In the Figma library, the main color is primary and the highlight is accent. Radius is the same base the code reads as --radius. A screen and the code are then talking about the same decision. There is no automated Figma-to-code sync. The library file keeps its light components. Its Theme collection has the original Blue app mode, plus Light (the same values) and Dark (the Blue app dark tokens). A comparison frame on the Components page shows button, input, card, navbar, dialog, and chat window in both modes. Editing code does not update that file. The file is YZ56DmRTCeU4kPOoMjS3RE.

To make corners rounder, change the theme and download it again. To invent a new button shape, edit the button once in code and once in the Figma library. The copies follow. Commit the theme file with the folder you copy.

/* Theme for Blue app
   Load the font "Outfit" in that project.
   These names match the Figma variables.
   Put data-theme="dark" on the page to use the dark set.
*/

:root {
  --background: #F4F7FB;
  --foreground: #0F172A;
  --muted: #E2E8F0;
  --muted-foreground: #475569;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --secondary: #E2E8F0;
  --secondary-foreground: #0F172A;
  --secondary-hover: #D1D7E0;
  --primary: #1035A3;
  --primary-foreground: #FFFFFF;
  --primary-hover: #3655B2;
  --accent: #0E80F2;
  --accent-tint: #CFE4FA;
  --accent-muted: #B4D6F8;
  --accent-text: #0E61B6;
  --on-accent: #FFFFFF;
  --overlay: rgba(0, 0, 0, 0.55);
  --overlay-hover: rgba(0, 0, 0, 0.64);
  --overlay-pressed: rgba(0, 0, 0, 0.72);
  --text-secondary: #475569;
  --text-disabled: #787E8A;
  --icon-primary: #0F172A;
  --icon-secondary: #475569;
  --icon-disabled: #787E8A;
  --ring: #0E80F2;
  --destructive: #B42318;
  --destructive-foreground: #FFFFFF;
  --destructive-hover: #9E1F15;
  --success: #067647;
  --success-tint: #CEE2DE;
  --success-text: #076843;
  --warning: #B54708;
  --warning-tint: #EADBD4;
  --warning-text: #9C400D;
  --gradient: none;
  --button-background: #1035A3;
  --radius: 14px;
  --font-sans: "Outfit", sans-serif;
  --font-heading: "Outfit", sans-serif;
  --foreground-base: #0F172A;
  --muted-foreground-base: #475569;
  --accent-text-base: #0E61B6;
  --button-background-base: #1035A3;
  --primary-foreground-base: #FFFFFF;
  --primary-hover-base: #3655B2;
  --secondary-base: #E2E8F0;
  --secondary-foreground-base: #0F172A;
  --secondary-hover-base: #D1D7E0;
  --border-base: #E2E8F0;
  --wash-foreground: #0F172A;
  --wash-muted-foreground: #475569;
  --wash-accent-text: #0E4B8C;
  --wash-button-background: #1035A3;
  --wash-button-foreground: #FFFFFF;
  --wash-button-hover: #3655B2;
  --wash-secondary: #1C1917;
  --wash-secondary-foreground: #FFFFFF;
  --wash-secondary-hover: #373533;
  --wash-border: #1C1917;
  --wash-darker: #A1CCF8;
  --type-ratio: 1.333;
  --type-display-size: 44px;
  --type-display-line-height: 51px;
  --type-display-weight: 600;
  --type-header-size: 33px;
  --type-header-line-height: 40px;
  --type-header-weight: 600;
  --type-subheader-size: 25px;
  --type-subheader-line-height: 31px;
  --type-subheader-weight: 500;
  --type-title-size: 19px;
  --type-title-line-height: 25px;
  --type-title-weight: 500;
  --type-body-size: 14px;
  --type-body-line-height: 21px;
  --type-body-weight: 400;
  --type-small-size: 11px;
  --type-small-line-height: 15px;
  --type-small-weight: 400;
  --type-size: 14px;
  --space: 4px;
  --control: 40px;
  --duration: 150ms;
  --button-radius: calc(var(--radius) * 0.8);
  --button-pad: calc(var(--space) * 4);
  --card-radius: calc(var(--radius) * 1.15);
  --card-pad: calc(var(--space) * 5);
  --field-radius: calc(var(--radius) * 0.7);
  --field-pad: calc(var(--space) * 3);
  --banner-radius: calc(var(--radius) * 0.8);
  --banner-pad: calc(var(--space) * 4);
  --segment-radius: calc(var(--radius) * 0.8);
  --segment-pad: calc(var(--space) * 1);
  --dialog-radius: calc(var(--radius) * 1.15);
  --dialog-pad: calc(var(--space) * 6);
  --menu-radius: calc(var(--radius) * 0.8);
  --menu-pad: calc(var(--space) * 1);
  --popover-radius: calc(var(--radius) * 0.9);
  --popover-pad: calc(var(--space) * 3);
  --section-radius: calc(var(--radius) * 1);
  --section-pad: calc(var(--space) * 4);
}

[data-theme="dark"] {
  --background: #0B1220;
  --foreground: #F8FAFC;
  --muted: #1E293B;
  --muted-foreground: #94A3B8;
  --card: #111827;
  --border: #334155;
  --secondary: #1E293B;
  --secondary-foreground: #F8FAFC;
  --secondary-hover: #2F3A4A;
  --primary: #1035A3;
  --primary-foreground: #FFFFFF;
  --primary-hover: #3655B2;
  --accent: #0E80F2;
  --accent-tint: #0B2442;
  --accent-muted: #0C315B;
  --accent-text: #3192F4;
  --on-accent: #FFFFFF;
  --overlay: rgba(0, 0, 0, 0.55);
  --overlay-hover: rgba(0, 0, 0, 0.64);
  --overlay-pressed: rgba(0, 0, 0, 0.72);
  --text-secondary: #94A3B8;
  --text-disabled: #8B8F97;
  --icon-primary: #F8FAFC;
  --icon-secondary: #94A3B8;
  --icon-disabled: #8B8F97;
  --ring: #0E80F2;
  --destructive: #F97066;
  --destructive-foreground: #1C1917;
  --destructive-hover: #FA8178;
  --success: #75E0A7;
  --success-tint: #1C3336;
  --success-text: #89E4B4;
  --warning: #FDB022;
  --warning-tint: #322B20;
  --warning-text: #FCBB43;
  --gradient: none;
  --button-background: #1035A3;
  --radius: 14px;
  --font-sans: "Outfit", sans-serif;
  --font-heading: "Outfit", sans-serif;
  --foreground-base: #F8FAFC;
  --muted-foreground-base: #94A3B8;
  --accent-text-base: #3192F4;
  --button-background-base: #1035A3;
  --primary-foreground-base: #FFFFFF;
  --primary-hover-base: #3655B2;
  --secondary-base: #1E293B;
  --secondary-foreground-base: #F8FAFC;
  --secondary-hover-base: #2F3A4A;
  --border-base: #334155;
  --wash-foreground: #F8FAFC;
  --wash-muted-foreground: #94A3B8;
  --wash-accent-text: #3192F4;
  --wash-button-background: #1035A3;
  --wash-button-foreground: #FFFFFF;
  --wash-button-hover: #3655B2;
  --wash-secondary: #FFFFFF;
  --wash-secondary-foreground: #1C1917;
  --wash-secondary-hover: #E4E3E3;
  --wash-border: #FFFFFF;
  --wash-darker: #0B1220;
  --type-ratio: 1.333;
  --type-display-size: 44px;
  --type-display-line-height: 51px;
  --type-display-weight: 600;
  --type-header-size: 33px;
  --type-header-line-height: 40px;
  --type-header-weight: 600;
  --type-subheader-size: 25px;
  --type-subheader-line-height: 31px;
  --type-subheader-weight: 500;
  --type-title-size: 19px;
  --type-title-line-height: 25px;
  --type-title-weight: 500;
  --type-body-size: 14px;
  --type-body-line-height: 21px;
  --type-body-weight: 400;
  --type-small-size: 11px;
  --type-small-line-height: 15px;
  --type-small-weight: 400;
  --type-size: 14px;
  --space: 4px;
  --control: 40px;
  --duration: 150ms;
  --button-radius: calc(var(--radius) * 0.8);
  --button-pad: calc(var(--space) * 4);
  --card-radius: calc(var(--radius) * 1.15);
  --card-pad: calc(var(--space) * 5);
  --field-radius: calc(var(--radius) * 0.7);
  --field-pad: calc(var(--space) * 3);
  --banner-radius: calc(var(--radius) * 0.8);
  --banner-pad: calc(var(--space) * 4);
  --segment-radius: calc(var(--radius) * 0.8);
  --segment-pad: calc(var(--space) * 1);
  --dialog-radius: calc(var(--radius) * 1.15);
  --dialog-pad: calc(var(--space) * 6);
  --menu-radius: calc(var(--radius) * 0.8);
  --menu-pad: calc(var(--space) * 1);
  --popover-radius: calc(var(--radius) * 0.9);
  --popover-pad: calc(var(--space) * 3);
  --section-radius: calc(var(--radius) * 1);
  --section-pad: calc(var(--space) * 4);
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
}

h1, h2, h3, .ds-heading, .ds-display, .ds-header, .ds-subheader, .ds-title {
  font-family: var(--font-heading);
}

/* Text on a wash. Primary buttons keep their own fill. A raised card opts back into the page colors. */
.ds-wash {
  color: var(--wash-foreground);
  --foreground: var(--wash-foreground);
  --muted-foreground: var(--wash-muted-foreground);
  --accent-text: var(--wash-accent-text);
  --secondary: var(--wash-secondary);
  --secondary-foreground: var(--wash-secondary-foreground);
  --secondary-hover: var(--wash-secondary-hover);
  --border: var(--wash-border);
}

.ds-wash [data-surface="raised"] {
  color: var(--foreground-base);
  --foreground: var(--foreground-base);
  --muted-foreground: var(--muted-foreground-base);
  --accent-text: var(--accent-text-base);
  --secondary: var(--secondary-base);
  --secondary-foreground: var(--secondary-foreground-base);
  --secondary-hover: var(--secondary-hover-base);
  --border: var(--border-base);
}

designed and built by Divyaray