TraceUITraceUI
FeaturesPricingBlog
Log inChromeAdd to Chrome
TraceUITraceUI

Copy code and design from any website. Create your personal UI design library of Colors, design systems, and components - saved, organized, and ready for your next build.

Product

FeaturesToolsCompareContact

Compare

vs DivMagicvs CSS Peepervs Magic UIvs Tweakcn

Free Tools

Color Palette ExtractorDesign System ExtractorFont IdentifierMedia DownloaderSVG GrabberAI Prompt GeneratorCSS Inspector

Legal

AboutBlogPrivacy PolicyTerms of ServiceDMCA Policy

Links

ThemefyZennboxAcsis

© 2026 Trace UI. All rights reserved.

A project by BhuwanA project by Bhuwan
Blog/Guides

How to turn a website's colors into Tailwind

Pull the colors off any live page, drop the one-off hex values, name what is left by role, and write them into a Tailwind v3 or v4 theme.

Bhuwan MahatoNov 18, 2026 · 3 min read

A page's colors are already in the browser. The work is deciding which of them are the palette, and which are a one-off badge or a hover state you do not want in the theme. This guide stops at color. For type, spacing, radii, and shadows, use how to extract a design system into Tailwind.

TL;DR

Check :root for color variables first. If the page has none, count color, background-color, and border-color in the console and keep the values that show up often. Name them by role (primary, muted) and add them under @theme in Tailwind v4, or theme.extend.colors in v3.

What you are collecting

You want the colors the page uses on purpose: page background, body text, a muted secondary text, borders, and one or two brand colors. You do not want every hex that appears once on an icon.

RoleWhere it usually shows upTailwind v4Tailwind v3
Page backgroundbody background--color-backgroundcolors.background
Body textParagraph color--color-foregroundcolors.foreground
Secondary textCaptions, labels--color-mutedcolors.muted
LinesBorders, dividers--color-bordercolors.border
BrandButtons, links--color-primarycolors.primary

Step 1: Read the variables the site already named

Sites built with Tailwind v4, shadcn/ui, or an in-house system often put the palette on :root as custom properties. In DevTools, select <html> and look at Styles. If you see --background, --primary, or similar, those names are the palette. Run this in the console to list only the color-like variables:

JavaScript
1const colors = {};
2for (const sheet of document.styleSheets) {
3 let rules;
4 try {
5 rules = sheet.cssRules;
6 } catch {
7 continue;
8 }
9 for (const rule of rules) {
10 if (rule.selectorText !== ":root") continue;
11 for (const name of rule.style) {
12 if (!name.startsWith("--")) continue;
13 const value = rule.style.getPropertyValue(name).trim();
14 if (/^(#|rgb|hsl|oklch|color-mix)/i.test(value)) colors[name] = value;
15 }
16 }
17}
18console.log(colors);
Dark theme

A second palette often sits on .dark or [data-theme="dark"]. Change the :root check to that selector and collect the dark set separately.

If this prints a short list of named colors, skip to Step 3. If it prints nothing, the colors are still on the page. They just were not given names.

Step 2: Count the colors the page actually paints

When there are no variables, count computed colors. Values that appear on dozens of elements are the theme. Values that appear once are noise.

JavaScript
1const counts = new Map();
2for (const el of document.querySelectorAll("*")) {
3 const style = getComputedStyle(el);
4 for (const prop of ["color", "background-color", "border-top-color"]) {
5 const value = style[prop];
6 if (!value || value === "rgba(0, 0, 0, 0)") continue;
7 counts.set(value, (counts.get(value) ?? 0) + 1);
8 }
9}
10console.table(
11 [...counts.entries()]
12 .sort((a, b) => b[1] - a[1])
13 .slice(0, 15)
14 .map(([color, count]) => ({ color, count })),
15);

Keep the top handful. Drop transparent, pure black from browser defaults if the site never uses it as a brand color, and any color that shows up on a single icon.

Free toolColor palette extractorGet the full color scheme from any webpage like backgrounds, text, borders, shadows and gradients and add to your own library as HEX, RGB and HSL.

Step 3: Write them into Tailwind

Name by role, not by the hex. primary still means something when the brand color changes. #7C3AED does not.

Tailwind v4, in your CSS:

CSS
1@theme {
2 --color-background: #fafafa;
3 --color-foreground: #18181b;
4 --color-muted: #71717a;
5 --color-border: #e4e4e7;
6 --color-primary: #7c3aed;
7}

bg-background, text-foreground, and bg-primary then work without a config file.

Tailwind v3, in tailwind.config.ts:

TypeScript
1import type { Config } from "tailwindcss";
2
3export default {
4 theme: {
5 extend: {
6 colors: {
7 background: "#fafafa",
8 foreground: "#18181b",
9 muted: "#71717a",
10 border: "#e4e4e7",
11 primary: "#7c3aed",
12 },
13 },
14 },
15} satisfies Config;

The hex values above are placeholders. Replace them with the ones you counted.

A palette is not a license

Taking a site's colors as a reference for your own theme is a starting point. Shipping a look that copies a product's brand, logo colors included, can still be their trade dress. Use the palette to study the roles, then change it to fit what you are shipping.

What this does not cover

Type, spacing, corner radius, and shadow are the rest of the look. The color names you just wrote are the first block of that theme. The rest of the steps are in extracting a design system into Tailwind. If you also need the font name, start with how to find what font a website uses.

On this page
  • What you are collecting
  • Step 1: Read the variables the site already named
  • Step 2: Count the colors the page actually paints
  • Step 3: Write them into Tailwind
  • What this does not cover

Keep reading

  • How to extract a famous website's design system and make it yours
    Guides

    How to extract a famous website's design system and make it yours

    Pull the colors, type, spacing, radius, and shadows from any live website with TraceUI, fine-tune them in the web editor, and export CSS, JSON, or shadcn tokens.

    Nov 26, 2026·4 min read
  • Extract design system from any website into a Tailwind Config
    Guides

    Extract design system from any website into a Tailwind Config

    Pull the colors, fonts, spacing, radii and shadows out of any live website with DevTools, then turn them into a clean Tailwind v3 or v4 theme.

    Sep 19, 2026·7 min read
  • TraceUI vs tweakcn: a theme editor or a design system from a live site?
    Comparisons

    TraceUI vs tweakcn: a theme editor or a design system from a live site?

    tweakcn builds a shadcn theme from a preset, prompt, or image. TraceUI reads colors, type, and spacing off a live site. Here is when each one fits.

    Nov 26, 2026·5 min read

See something you like? Ship it in one click.

ChromeBraveEdge

Works in Chrome, Brave and Edge.

Start Creating