Export a Website Design System as CSS Custom Properties

Build an honest CSS custom property file from observed website details, with semantic names, confidence notes, and practical usage guidance.

export a website design system as css custom properties

To export a website design system as CSS custom properties, collect the visible colors, typography, spacing, borders, radii, shadows, and repeated component patterns. Then map those observations to semantic variables that your own project can use. Treat the result as an observed reference export, not as proof of the source site's official internal design system.

Start with the values that repeat

Do not turn every measured pixel into a variable. Begin with values that repeat or describe a clear role:

  • Page background, surfaces, borders, primary text, muted text, and accent colors
  • Font families, available weights, approximate sizes, and line heights
  • Repeated spacing between sections, cards, controls, and text groups
  • Common border widths, corner radii, shadows, and control heights
  • Shared patterns for buttons, inputs, cards, navigation items, and badges

Use names such as --color-text-primary and --radius-control instead of names that only describe a raw color or one page location. Keep the original observation beside each semantic assignment so you can revise the role later.

The captured Linear example below is paired with a typography result using Inter at weights 400 and 500. Use it as a grounded example of how a reference can inform an export, not as a universal token set.

Captured pages

Linear typography

  • Inter

    Weight 400

  • Inter

    Weight 500

Create an editable CSS file

Use a small semantic layer, then let components consume it:

The sample values above show the shape of an export. Replace them with values supported by the reference, and remove categories that were not observed. Create component variables only when a pattern repeats. A one-off hero treatment belongs in a component note unless it establishes a broader rule. If the reference shows both light and dark states, keep their values in separate theme scopes rather than silently choosing one.

Keep evidence beside every value

CSS is convenient but loses context. Keep a companion JSON record or comments for source, role, and confidence:

Use observed when the capture directly supports a value, estimated when you measured a visual relationship, and unverified when a placeholder still needs checking. Include responsive, hover, focus, and dark-mode values only when those states were actually observed. If a state is a project decision, label it as such.

Before sharing the file, check that every variable has a role, every unit is explicit, font weights are available, repeated spacing is grouped sensibly, and components use variables instead of duplicated values. Compare the rendered result against the reference at the same viewport, then review the generated diff. Also check text wrapping, contrast, control dimensions, and fallback fonts. Those checks often reveal that a token is close numerically but wrong in practical use.

Use this in your AI agent

> Inspect the supplied website reference and export a CSS custom property file from supported observed details. Use semantic names for colors, typography, spacing, borders, radii, shadows, and repeated component values. Keep a companion record of source context, confidence, estimates, and limitations. Include only states that were actually observed, validate the CSS, and clearly label the result as an observed reference export rather than the website's official internal design system. Use the captured examples below to guide the visual comparison. > > Install Fudge for your AI agent

Which CSS custom properties should I create first for a small website reference?

Start with the smallest set that explains repeated choices: page background, surface, primary text, muted text, border, accent, body font, heading weight, body size, line height, two or three spacing steps, one or two radii, and one shadow. Add control height and focus styling only when those patterns are visible.

Use semantic roles rather than raw color names:

Replace the sample values with supported observations. Keep one-off treatments in component CSS and record uncertain values beside the export instead of presenting them as established facts. Then test the variables on a heading, paragraph, button, card, and input. If a token does not improve consistency across at least two uses, keep it local until more evidence appears.

How can I make the CSS export useful for responsive layouts and component states?

Separate what the reference proves from what your project still needs to decide. A single desktop capture can support visible colors, type roles, radii, and spacing, but it may not establish mobile gutters, hover behavior, focus rings, or breakpoint changes.

Organize the file so later states can be added without changing component code:

Mark the mobile value as a project decision if it was not visible in the reference. Document the selector and interaction that still needs checking. Review text, icons, borders, controls, and focus indicators in every observed theme and state. For each new breakpoint, compare wrapping and spacing in a browser at the target width, and keep a short change note so later edits do not turn an assumption into a claimed observation.