Development Journey7 min read

CSS Design Tokens: Rebrand a Dark Site to Light

A dark-to-light rebrand done as a CSS design token remap in one stylesheet plus a hunt for hard-coded colors, verified by contrast ratios and screenshots.

tl;dr A dark-to-light rebrand of a site built on CSS design tokens was a value remap in one stylesheet plus a sweep for hard-coded colors, not a rewrite of every page. Token names were kept and marked historical, one dark footer re-pointed its tokens locally, and the result was checked with computed contrast ratios and full-page screenshots at 1440px and 390px.

A palette swap looks like a rewrite of every page. It only is one if the colors are scattered. When a site reads its colors from CSS custom properties (design tokens), the swap can be a few value changes. The catch is the surface that skips the tokens. A hex value typed into one page keeps the old color after the swap. Mix that with a remapped token and you get dark text on a dark field.

This post covers one such rebrand, from a dark theme to a light one, on a 166-page site built with Astro (a static site framework). The work was a token remap, a sweep for literals, one local override for the surface that stays dark, and a verification pass. By the end you should be able to run the same audit on your own stylesheet.

Start with the audit, not the edit

I ran the work in one session of Claude Code (an AI coding agent) with the model Claude Opus 5.5. Once I had picked the color direction, the model’s first step, before any edit, was to check how much color came from shared tokens and how much was typed into individual pages. The change record’s answer: almost every surface already read its color from tokens. That made a remap the cheap path.

Counted afterward from the commit and its parent: before the change, the source held 248 references to var(--intent-*) or var(--color-*) across 9 files. Those nine are mostly shared pieces such as the navigation, the footer, two layouts and three stylesheets. After it, 348 across 14 files, out of 75 source files (.astro, .tsx, .css and .mjs). The 100 added references arrived with this change, which converted literals to tokens and added new rules that read them.

The session also read the written brand contract, a document that locked in the existing fonts and colors, before changing anything. The contract was amended in the same change, so nobody reverts the new look later.

The old palette was Tailwind’s stock zinc scale with stock orange-500 as the accent, set in Inter and Syne. Many generated sites start from the same defaults. That was the reason for the change, not the mechanism.

Remap the values, keep the names

The core move lives in one stylesheet. The token values were inverted. The token names stayed. This is an excerpt, with the old values added as comments for this post:

/* Token names are historical: "ink" is the page ground and "text" the type, whatever their values. */
:root {
  --intent-stripe: #FFC21A;   /* road-stripe yellow */
  --intent-sign: #151513;     /* sign black */
  --intent-ink: #FFFFFF;      /* page ground, was #09090b */
  --intent-text: #151513;     /* type, was #fafafa */
  --intent-accent: #151513;   /* primary action ground, was #f97316 */
}

Keeping the names meant the existing references did not change. The cost is that the names now lie. --intent-ink is white. Elsewhere in the same file, --color-orange holds sign black, kept so existing references still resolve. A new engineer reading background: var(--intent-ink) gets the right color and the wrong picture. The comment is the only guard, so write it on day one.

The two font tokens took one value each: Overpass for display and body.

The literals the remap could not reach

The sweep found the places a remap cannot touch. The projects page typed Tailwind zinc values straight into its CSS. Inputs had a #18181b background and #fafafa text. Placeholders and borders used #a1a1aa and #3f3f46. The button border was #fb923c. A token remap would have left that page styled for the old dark theme.

Those literals were replaced with tokens. About, the contact page, the directory layout and the page that maps the company’s systems needed the same kind of fix. So did three pages (the 404 page and the two field-notes templates) that never used hex values at all. They used Tailwind utility classes such as bg-zinc-950 and text-zinc-400, which carry the old palette just as firmly.

On the projects page, two borders went from 1px to 2px in the same edit. The 2px rule is part of the new look and shows up across the commit. So this was a visual change beyond color, and it should be reviewed as one.

To run the same sweep on your own site, search the source for hex and rgb( color values, and separately for palette utility classes (zinc-, orange- and so on). A hex search alone would have missed those three pages. The token definitions in the global stylesheet will match too. Ignore those. Every other hit is a decision: move it to a token, or record why it stays.

One page surface stays black: the footer, which the brand contract calls the one black sign on the page. (The diagram figures also stay dark. They were recolored at their own sources.) Rather than build a second theme, the footer’s tokens are re-pointed inside its own selector (excerpt):

.site-footer {
  --intent-text: #FFFFFF;
  --intent-muted: #C9C6BC;
  --intent-brand: #FFFFFF;
  --intent-accent-hi: var(--intent-stripe);
  --intent-line-soft: rgb(255 255 255 / 0.16);
  background: var(--intent-sign);
  color: var(--intent-text);
}

The footer’s child rules read these tokens by name, so none of their color declarations changed. The footer’s own rule took the color edits: the background now points at --intent-sign and color is new, as shown. Outside color, the same commit made the top border 2px and the brand link heavier (font weight 700 to 900). Custom properties inherit, so the footer’s children pick up the local values. Nothing outside the footer selector sees them.

The logo was not a palette decision

The model’s first mockups replaced the logo with a new shape. I stopped that with one message: “hold on our logo is our logo u can change the colors but the logo is the logo.”

The mark kept its exact shape. The new files are recolored copies of the existing image. The rule went into the brand contract as a line of its own: the mark keeps its exact shape, and only its color changes. This was the one real course correction in the session. The CSS work itself had no reversal.

What the checks showed

The contrast ratios were computed, not eyeballed. From the change record:

  • Sign black and stripe yellow, the pair used for the header and the primary button: 11.3:1
  • Muted text on white: 8.5:1
  • Muted text on stripe yellow: 5.2:1
  • Muted footer text on black: 10.7:1

The contract also bans yellow text on white, which measures 1.6:1. A remap will happily produce that pair if you let it, so the ban is written down.

For layout, the build produced 166 pages. Full-page screenshots covered 13 routes at 1440px and 390px, and none had horizontal overflow. That is 13 routes on a 166-page build, not every page. The browser checks covered 4 viewports and 10 routes, including 200% reflow and touch targets. A separate browser test made 48 visits. The change record names no surface that came out dark-on-dark or light-on-light. The screenshot pass was the check for that.

From picking the direction to the merge took about an hour: the direction was chosen at 05:06 UTC and the pull request merged at 06:05 UTC.

What was left for later

Three follow-ups were left. The navigation bar shared across the company’s sites still uses orange for its current item, and gets its own pull request. The About film still shows the orange mark and needs a re-cut. The third is not about color: more team members still need adding to the team section.

The full change is pull request #106 in jeremylongshore/intent-solutions-landing, merged on 2026-11-28: https://github.com/jeremylongshore/intent-solutions-landing/pull/106. Rollback is a revert of that pull request.

Use this

  • Before a palette swap, list the files that hold literal color values or palette utility classes, next to the files that read var(--...) tokens. If the literals cluster on a few pages, fix those pages first. The rest is a remap.
  • When you remap, keep the token names, add a comment that the names are historical, and re-point tokens locally in the selector of any surface that stays dark.
  • Before you call it done, compute the contrast ratio for each text and background pair, then screenshot at least one route per page template at a desktop width and a phone width, and check each for horizontal overflow.