Turn a website's design system into a Tailwind theme
Run vibiz design <url> --tailwind to inspect any website's styles and generate a Tailwind v4 @theme configuration, CSS tokens, and an agent brief.
On this page 8 sections
You can extract a website's design system into a ready-to-use Tailwind theme by running vibiz design <url> --tailwind. thelastapi renders the page across desktop and mobile viewports, inspects computed styles and external stylesheets, and generates a Tailwind v4 @theme block alongside design tokens and a markdown brief. The process takes 20 to 90 seconds, costs one to three cents, and gives your team or AI agent exact measurements for colors, typography, radii, and spacing rhythm.
Whether you want to audit your existing site or study the layout patterns of a site you admire, here is how to extract and apply those styles.
How design extraction works
Measuring a modern web page by inspecting raw source code rarely works. Styles live across utility classes, CSS variables, CSS-in-JS, and responsive media queries.
The web.design action evaluates a site using three passes:
- The rendered page. The browser loads the target URL at 1440 px for desktop and 390 px for mobile. It dismisses cookie notices and chat popups, then scrolls down the page so lazy-loaded elements appear. It captures computed styles for typography, buttons, form inputs, badges, cards, navbars, and frame wrappers. It also records how frequently each color and radius appears across the DOM.
- The stylesheets. The runner reads public CSS files to extract custom properties (
:rootand dark mode blocks),@font-facedefinitions, and breakpoints. - A vision pass. A vision model (Gemini Flash, the model behind
vibiz/balanced) reviews the screenshots alongside the structural outline. It labels section patterns—like split heroes, feature grids, and footers—so your build tools understand visual structure rather than just raw colors.
If client-side scripts block rendering, the system falls back to analyzing raw markup and CSS files, setting confidence.computed_styles: false.
Extracting a Tailwind theme with the CLI
The quickest way to extract styles is with the vibiz CLI. Run:
vibiz design https://example.com --tailwindThis command runs the inspection and outputs two files in your current working directory:
design.tailwind.css: A clean Tailwind v4@themestylesheet ready to drop into your build.design.md: A structured markdown brief describing typography, color hierarchies, component styles, and section layouts.
You can also pass additional routes on the same domain to sample styling across different layouts:
vibiz design https://example.com --pages /pricing,/about --tailwind --out spec.mdTo force a fresh inspection instead of using a cached run from the last 24 hours, pass --fresh:
vibiz design https://example.com --tailwind --freshRunning the extraction through the API or SDK
If you are orchestrating builds with AI agents or running background worker jobs, call the web.design action via HTTP, the Node SDK, or MCP tools. You can read more about supported web endpoints in the Web data documentation.
With HTTP
Make a standard POST request against the unified API:
curl https://thelastapi.dev/v1/actions/web.design \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"url": "https://example.com",
"viewports": ["desktop", "mobile"]
}
}'With the SDK
Within a project running @vibiz/app, use the design SDK:
import { vibiz } from '@vibiz/app';
const spec = await vibiz.design.extract({
url: 'https://example.com',
pages: ['/pricing'],
});
console.log(spec.exports.tailwind_theme);
console.log(spec.tokens.colors.roles);AI agents using Cursor, Claude Code, or Cline can invoke the vibiz_web_design MCP tool directly with { "url": "https://example.com" }.
What the generated design tokens look like
The engine structures its extraction into normalized tokens, component measurements, and export blocks. The full reference is described in the Design documentation.
A returned JSON payload contains:
{
"object": "design_spec",
"url": "https://example.com/",
"usage": "reference",
"tokens": {
"colors": {
"scheme": "light",
"roles": {
"background": "#ffffff",
"text": "#0a0a0a",
"text_muted": "#737373",
"primary": "#f38c0d",
"surface": "#f6f6f1",
"border": "#e5e5e5"
},
"palette": [{ "hex": "#0a0a0a", "count": 4251, "uses": ["text"] }]
},
"typography": {
"families": [
{ "family": "Inter", "role": "body", "source": "google" }
],
"scale": {
"h1": { "size": "64px", "weight": "300", "line_height": "1.1" },
"body": { "size": "16px", "weight": "400", "line_height": "1.6" }
},
"mobile_scale": {
"h1": { "size": "44px", "line_height": "1.1" }
}
},
"radii": { "sm": "4px", "md": "16px", "lg": "24px", "full": true },
"spacing": { "base": 8, "scale": [8, 16, 24, 32, 48, 64, 96] }
},
"exports": {
"tailwind_theme": "@import \"tailwindcss\";\n\n@theme {\n --color-primary: #f38c0d;\n --color-surface: #f6f6f1;\n --radius-md: 16px;\n --font-body: Inter, sans-serif;\n}"
}
}The exports.tailwind_theme string uses the modern Tailwind v4 @theme syntax. You paste it directly into your global CSS entry file without maintaining legacy configuration files.
Reference sites versus your own site
When you inspect a website, you must specify whether the site belongs to you.
| Feature | Reference mode (own_site: false) | Own site mode (own_site: true) |
|---|---|---|
| Intended use | Studying design patterns and rhythm | Rebuilding or maintaining an existing property |
| Usage flag | "reference" | "use" |
| Brand assets | Logos detected but never downloaded | Logo, favicon, and social images copied to project Files |
| Typography | Proprietary fonts swapped for closest free font | Original font files and source paths preserved |
| Section text | Replaced with neutral dummy text | Original copy preserved |
| Export themes | Semantic roles mapped to variable slots | Exact palette and custom properties exported |
To extract an existing company project:
vibiz design https://my-company.com --own --tailwind --shadcnThis exports your true brand tokens, generates a Tailwind @theme alongside a shadcn/ui :root theme, and moves your brand logos to your project's hosted storage.
When extracting third-party references, the tool strips proprietary content. You receive structural values (padding, layout bounds, typographic scale) while keeping your implementation legally clean. For capturing general webpage screenshots alongside design work, see how to screenshot a web page with an API.
Rebuilding page sections from HTML and CSS captures
Sometimes an abstract design spec is not enough. You may want to inspect how specific components—like a hero section or a pricing grid—were constructed in the browser.
Run a section capture using the --sections flag:
vibiz design https://example.com --sectionsThe system breaks the rendered page into visual sections (up to 10), returning bounding boxes, semantic types (hero, header, footer), and thumbnail images.
To inspect a single section in detail:
vibiz design https://example.com --section 1This returns an isolated bundle containing:
- The section screenshot.
- Self-contained HTML.
- Scoped CSS that strips unused global rules and establishes its own local styling reset.
- Suggested free font replacements.
Reading a section from a previous capture is free. You can hand this section bundle to an agent or use it as a scaffold when writing new Tailwind components. If you also need the raw written content of the target site for documentation or copy modeling, check our guide to scraping a website to markdown with one API call.
Next step
Run vibiz design https://example.com --tailwind on a site that matches your aesthetic goals, then paste the exported @theme into your styling entry point. If you are building an entire app from a conversational prompt, see how to deploy a website from Claude or ChatGPT with nothing installed.
Frequently asked questions
What version of Tailwind CSS does the design export support?
The tool exports CSS for Tailwind CSS v4 using the `@theme` directive, allowing you to drop color tokens, font families, and radii directly into your main stylesheet.
How much does it cost to extract a design system?
A typical design extraction inspecting desktop and mobile viewports costs between $0.01 and $0.03. Results for identical inputs are reused from a copy up to 24 hours old unless you pass the `--fresh` flag.
Can the tool copy proprietary logos and fonts from other websites?
No. When run in reference mode (the default), external logos and images are replaced with neutral placeholders, and proprietary fonts are mapped to the closest free Google Font alternatives. Brand assets are only copied if you pass `--own` to verify ownership of your site.
Can I use design extraction without hosting my project on the platform?
Yes. The `vibiz design` CLI command and the `web.design` API action work independently using your account API key, with no requirement to host your application or database on the service.