How to choose a website color palette (with Tailwind tokens)
A site palette you can set up in an afternoon. A neutral ramp, one accent, clear rules for where color can go, and a Tailwind v4 token block to paste.

The short version
- Pick one accent color from your product, logo or photos, test it for contrast, and use neutrals for everything else.
- Use the accent only for actions, data and status. Keep headlines, backgrounds, icons and navigation neutral.
- Write the palette as Tailwind v4 @theme tokens named by role. Then add color rules to CLAUDE.md so your agent only uses those tokens.
On this page
Many AI-built sites don’t have a palette. They have whatever the model grabbed first: an indigo button, a violet gradient behind the headline, a teal badge, a pink highlight on one card, and five slightly different grays picked one component at a time. Each one is fine alone. Together it looks like nobody decided anything.
One decision fixes it. Pick a single accent color, and make everything else neutral. This post shows how to pick the neutrals, where the accent can go, how to write it all as Tailwind v4 tokens, and how to make your agent stick to it.
Why one accent works
When everything has a color, nothing stands out. The eye has nothing to follow. When the page is mostly neutral, the one colored thing on screen is clearly the thing to look at or press.

One accent is also easier to keep up. Neither you nor your agent has to guess which blue a new button uses.
The default violet looks generic because it’s everywhere. This post is about what to use instead.
Step 1: choose the accent
Pick it from something real, not from a color wheel:
- Your product. If your app already has a main button color, use it on the marketing site too.
- Your logo or photos. Take one color from an image you’ll really show on the page.
- Your category, against the grain. If every competitor is blue, a deep green or a warm orange will stand out.

Example: Forta, a designed Astro template on Aymu. Neutral page, one dark accent on the main button.
Then run one test. Put white text on a button filled with the accent, and put the accent as text on your page background. Check both in a contrast checker. WCAG asks for at least 4.5:1 for body text, and 3:1 for large text and UI parts like button edges and icons. If the accent fails as text, darken it until it passes. Or only use it as a fill, with dark or white text on top.
That is the whole decision. Write the hex value down.
Step 2: build a neutral ramp
Neutrals do almost all the work: page background, card surfaces, text, muted text, dividers, form fields. You need more of them than you think. They should be one family, not grays picked one at a time.

A ramp of about ten steps covers most sites. Plain gray is fine. For a warmer or cooler page, tint the whole ramp slightly toward your accent’s hue. Keep the tint small, so the neutrals still look neutral.
Name the steps by role, not by number, so a component can say what it means:
canvas: the page backgroundsurface: cards and panels that sit on the canvassunken: controls and wells, a step darker than surfaceline: dividers and form field bordersmuted: secondary text, captions, placeholdersink: primary text and dark panels
Separate surfaces by tone, not outlines. A white card on a very light gray canvas has a clear edge with no border or shadow. That alone removes a lot of the generated look, because thin borders and soft drop shadows on every box are another default.
Step 3: decide where color is allowed
This rule keeps the palette clean six months from now. The accent goes in three places only:
- Actions. Primary buttons, links, the focused or selected state of a control.
- Data. A line in a chart, the highlighted bar, a progress fill.
- Status. Success, warning and error, which may need their own colors (see below).
It doesn’t go on section backgrounds, headlines, decorative icons, card borders, or a gradient behind the hero. Navigation stays neutral. To make a headline stand out, make it bigger or heavier. The post on fonts covers how to get contrast from type instead.
Status colors are the one place you add more hues. Keep them muted and only use them for status, never for decoration. If your accent is green, your success color can just be the accent.
Step 4: write the tokens
Tailwind v4 reads design tokens from an @theme block in your CSS. Each --color-* variable becomes a utility, so
--color-surface gives you bg-surface, text-surface and so on. Here’s a block to paste and adjust. The values are
a starting point, with a slightly warm neutral ramp. Swap in your own accent and check contrast again.
@import 'tailwindcss';
@theme {
/* Neutrals: one family, named by role */
--color-canvas: #f4f3f0;
--color-surface: #ffffff;
--color-sunken: #e6e4df;
--color-line: #d2cfc8;
--color-muted: #5a5650;
--color-ink: #1d1b18;
/* The one decision */
--color-accent: #1f5c4a; /* a deep green */
--color-accent-ink: #ffffff; /* text on an accent fill */
/* Status, used only for status */
--color-success: var(--color-accent); /* the accent is already green */
--color-warning: #8a5a00;
--color-danger: #a8261c;
}
@layer base {
body {
background-color: var(--color-canvas);
color: var(--color-ink);
}
}
Then use the roles in markup:
<section class="bg-canvas py-24">
<div class="mx-auto max-w-5xl rounded-2xl bg-surface p-10">
<h2 class="text-3xl font-semibold text-ink">Invoices in one place</h2>
<p class="mt-3 text-muted">Every client, every due date, on one screen.</p>
<a href="/signup" class="mt-6 inline-block rounded-lg bg-accent px-5 py-3 text-accent-ink"> Create an invoice </a>
</div>
</section>
Look at what’s missing: no indigo-600, no from-violet-500 to-blue-500, no shadow-lg. Every color class in the
file comes from your palette.
Step 5: check contrast once
Before you move on, test these pairs in a contrast checker:
inkoncanvasand onsurfacemutedoncanvasand onsurfaceaccent-inkonaccentaccentonsurface, if you use it for links- each status color on
surface
Watch muted most. Light gray secondary text looks calm in a screenshot but is hard to read on a phone in
daylight. If it fails 4.5:1, darken it.
Dark mode is the same exercise: redefine the same token names and test the same pairs.
Step 6: tell your agent
The tokens only help if new code uses them. Add a short rule to your CLAUDE.md:
## Color
- Use only color tokens from `src/styles/theme.css` (bg-canvas, bg-surface, bg-sunken,
text-ink, text-muted, border-line, bg-accent, text-accent-ink, success/warning/danger).
- Never use Tailwind's default palette classes (indigo, violet, slate, gray and so on)
or raw hex values in components.
- The accent is for actions, data and the selected state only. Not for headings,
backgrounds, icons or decoration.
- No gradients. Separate surfaces by background tone, not borders or shadows.
Then give it a cleanup pass on the existing code:
Search the project for Tailwind default palette classes (indigo, violet, purple, blue,
slate, gray, zinc and so on), raw hex colors, gradient utilities and shadow utilities in
.astro and .css files. Replace each with the closest token from the @theme block in
src/styles/theme.css, following the color rules in CLAUDE.md. List every file you changed
and any place where you weren't sure which token fits.
The last sentence makes the agent tell you about hard cases instead of quietly picking a color.
What to do today
- Pick one accent from your product, logo or photos, and test it for contrast.
- Paste the
@themeblock, set your accent, and adjust the neutrals if you want a warmer or cooler page. - Add the color rules to
CLAUDE.mdand run the cleanup prompt. - Reload the site and look for anything that is still colored but isn’t an action, data or status. Make it neutral.
Once color is done, the next most visible problem is usually spacing. Read spacing is why your AI site feels cheap next, and keep the rules file growing with design rules Claude Code actually follows.
Share this post
Ask an AI about this post
Written byMuhammad SumonDeveloper and UI/UX designer

