Design Tokens for AI: Extract a Website's Real Colours, Fonts, Shadows and Icons So an LLM Builds On Brand

2026-11-20来源 dev.toEnglish

Originally published on Crafttor.

TL;DR: LLMs drift off brand because nobody gave them the brand. Design tokens for AI fix that: a short, exact list of colours, gradients, type, radii, shadows and icons that the model must use. WebCapture to Figma's Copy for LLM hands over those real values from a live page. You condense them into a token file or a style section, then reuse it in every prompt to Claude or ChatGPT.

Ask an AI for "a pricing card in our style" and you get a nice card in someone else's style. The blue is a little off. The radius is 12 instead of 8. The font is Inter because Inter is safe. None of it is wrong, it just is not yours.

The fix is not a longer adjective list. It is data. This post shows how to get the real style data from a site you own, how to shape it into tokens, and how to put it in a prompt so the model follows it.

What design tokens are, in one paragraph

Design tokens are named values for design decisions. color.brand.primary instead of #2160ff. radius.card instead of 8px. They live in a JSON file, in CSS custom properties, or in Figma variables. For people, tokens keep a system consistent. For an LLM, they do something extra: they turn "on brand" from a feeling into a list it can check against.

Why screenshots and URLs are not enough

A screenshot gives a model pixels. It has to estimate hex values from compressed colours, guess the font from letter shapes, and approximate shadows by eye. Gradients are the worst case: the model sees a blend, not the stops.

A bare URL is often no better. The model may not be able to open it, and even when a tool fetches the HTML, the final style lives in computed CSS across many files.

What you want is the page as the browser rendered it, with values already resolved. That is what a capture gives you.

What Copy for LLM hands over

Open the page in Chrome and capture it with the WebCapture to Figma extension. Then press Copy for LLM. The text on your clipboard carries:

  • Layout. The structure and boxes of the page.
  • Colours. Including real gradient stops, not just a "blue to purple" description.
  • Borders and shadows. The actual border and shadow values.
  • Fonts. The type used on the page.
  • Icons. As inline SVG, so the model uses your icons rather than look-alikes.
  • Interactions. Every interaction, plus any flow you recorded.

That is far more than a style guide. It is a full description of one page. For tokens, you want to compress it into the reusable part.

Capture or rebuild only designs you own or have permission to use.

Turning the capture into design tokens for AI

Option A: ask the model to extract them

Paste the Copy for LLM text into Claude or ChatGPT with an extraction prompt:

"From the captured page below, extract design tokens. Output JSON with groups: color, gradient, font, fontSize, fontWeight, lineHeight, radius, shadow, border, spacing. Use semantic names (brand, surface, text, muted, accent). Only include values that appear in the capture. Do not invent values. After the JSON, list any value you were unsure how to name."

The "do not invent" line is important. Without it, a model may fill gaps in a scale with tidy numbers that never appeared on the page.

A trimmed result might look like this:

{ "color": { "brand": "#2160ff", "text": "#24252b", "accent": "#c9f56a", "surface": "#ffffff" }, "gradient": { "hero": "linear-gradient(135deg, #2160ff 0%, #7a5cff 100%)" }, "font": { "body": "Inter, sans-serif" }, "radius": { "card": "8px", "pill": "999px" }, "shadow": { "card": "0 8px 24px rgba(36, 37, 43, 0.08)" } } 

Treat this as a draft. Check every value against the capture before you rely on it.

Option B: read them from the Figma import

Import the same page with the plugin. You get editable frames where colours, gradients, shadows, borders, corner radii and type are real layer properties. Select a button and the inspector shows its fill, radius and effect values.

This route is slower but very reliable, and it is the natural path if you want Figma variables. Create the variables by hand from what you see, then bind them to the imported layers. For a fuller audit approach, see our guide to a design system audit from screenshots.

Option C: keep icons as a separate pack

Tokens cover values. Icons are assets. Copy the inline SVG of each icon you want the model to reuse into a short "icons" block with a name per icon. Then you can say "use the arrow-right icon" in later prompts.

Writing the style section of a prompt

Once you have tokens, wrap them in a fixed block you paste at the top of every UI prompt. Something like:

STYLE (must follow) - Use only these tokens. If a value is missing, ask instead of inventing. - Colours: brand #2160ff, text #24252b, accent #c9f56a, surface #ffffff - Hero gradient: linear-gradient(135deg, #2160ff 0%, #7a5cff 100%) - Font: Inter for all text. Weights 400, 600 only. - Radius: 8px cards, 999px pills. Shadow on cards only: 0 8px 24px rgba(36,37,43,0.08) - Icons: use the SVGs in the ICONS block. No icon fonts, no emoji. 

Then the task goes below: "Build a pricing section with three plans." Short, strict, reusable.

Why a fixed block beats describing the brand

  • It is checkable. You can scan the output for any hex that is not on the list.
  • It survives long chats. Paste it again when the model starts drifting.
  • It is portable. The same block works in Claude, ChatGPT or a Figma code layer's AI.

Tokens as CSS custom properties

If the model writes HTML and CSS, ask it to start from custom properties so every later change flows from one place:

:root { --color-brand: #2160ff; --color-text: #24252b; --radius-card: 8px; --shadow-card: 0 8px 24px rgba(36, 37, 43, 0.08); } .card { border-radius: var(--radius-card); box-shadow: var(--shadow-card); } 

A rule in your prompt such as "never write a raw hex outside :root" makes review much faster.

A quick review checklist

After the model returns UI, run through this list:

Check What to look for
Colour Any hex or rgb not in the token list
Gradient Stops and angle match the token
Type Font family and weights match, no surprise fallback
Radius Cards and buttons use the named radii
Shadow Shadows only where the tokens allow
Icons Your SVGs, not generic substitutes

If you only need a colour palette rather than a full token set, our post on extracting colours from a screenshot in Figma is a lighter starting point.

Privacy

With the Chrome extension, captures pasted into the plugin stay on your machine. If you capture by URL instead, the URL is sent to Apify to be rendered using your own Apify token. Nothing from your Figma file is uploaded, and the plugin never sends anything to an AI. You paste the text yourself, so you choose what the model sees.

Build your token block once, reuse it everywhere

One careful capture of your homepage can give you a token file that keeps every later AI request on brand. Do it once, check every value, and keep the style block next to your prompts.

WebCapture to Figma is a free plugin. Capture a page you own and pull out its tokens today.

FAQ

What are design tokens for AI?

They are a compact, named list of your real style values that you give an LLM, so it builds UI with your colours, type, radii, shadows and icons instead of its defaults.

Does WebCapture create Figma variables automatically?

No. It imports real values onto editable layers and copies them as text with Copy for LLM. You create tokens or variables from those values.

Will the model still invent values?

Sometimes. Tell it to use only the listed tokens and to ask when one is missing, then check the output against your list.

Can I extract tokens from a page behind a login?

Yes. Use the WebCapture Chrome extension, which captures the page as you see it. No Apify token is needed for that path.

Does this work with ChatGPT as well as Claude?

Yes. The token block is plain text, so it works in Claude, ChatGPT or a Figma code layer's AI.

原文:https://www.a8q9.cn/en/article/design-tokens-for-ai-extract-a-website-s-real-colours-fonts-shadows-and-icons-so-e075d5.html

相关文章