Skip to content
Arrow keys to move, Enter to open, Esc to closeAll results
Design and Builders · Guides

The 60-30-10 Color Rule for WordPress Sites (With Code)

Learn the 60-30-10 color rule for WordPress: pick a base, secondary and accent, pass WCAG contrast, and build the palette with CSS variables and theme.json.

Written by
WPresident Editorial
Topic
Design and Builders

Open the home page of an average small-business WordPress site and count the colors. A blue header the owner picked from the logo. A green button a template designer liked. A pale gray band, then a slightly different pale gray band, an orange badge, and links in a third blue. Every choice was defensible on its own. Together they make the page look assembled by committee, which it usually was.

The 60-30-10 rule is a cheap, old fix for that. It says a layout feels coherent when one color dominates about 60 percent of what you see, a second color supports it across about 30 percent, and a third, stronger color is held back for about 10 percent. Designers borrowed it from interior decoration, where the three shares are walls, furniture and small accents, and it travels to screens because the underlying problem is the same: when too many things speak at the same volume, nobody is heard.

Two honest caveats before anything else. The rule is a heuristic, not a standard. No specification requires it, WordPress has no setting for it, and a site at 70-25-5 is not broken. And the percentages are not the point. The useful part is that the rule forces you to give every color a job: the quiet surface that holds the content, the structure that organizes it, and the accent that says act here. Once colors have jobs, the percentages mostly take care of themselves, and, more importantly, you can write those jobs into code.

That is the angle of this tutorial. It treats 60-30-10 as a role system and then does the unglamorous work that lets it survive a real site: how the shares apply to a web page, how to turn one brand color into a base, a secondary and an accent, why gray should almost never be pure gray, and why a brand orange that looks fine in a logo often cannot carry white button text. It then encodes the roles as CSS custom properties and as a theme.json palette, derives tints with oklch and color-mix, covers dark mode, and ends with testing and common mistakes.

One worked example runs through the whole guide: an invented landscape-design studio with an orange logo, a calm warm look in mind and no design budget. It is illustrative, not a real client. Every contrast ratio quoted comes from the WCAG formula applied to the example colors, not from a study or a device measurement, and the testing section includes a script so you can reproduce each number and rerun it on your own palette. Browser support for the newer CSS color features keeps moving, so check a current compatibility table against your own audience.

The single most important idea is this: decide roles first and colors second, then write the roles down once, in code. A palette that lives as hex values scattered through a theme, a page builder and some pasted custom CSS will drift no matter how good the original proportions were. A palette that lives as a small set of named roles stays in proportion when a third person adds a landing page. Accessibility is the other half. The rule says nothing about whether text can be read, and that is where most good-looking palettes fail, so contrast gets its own section and runs through every example that follows.

Key points

  • Treat 60-30-10 as three roles, surface, structure and accent, and let the percentages follow; it is a heuristic, not a standard and not a WordPress feature.
  • Your brand color is rarely the 60. A saturated brand color usually belongs in the 10, a deep one in the 30, and neutrals tinted toward the brand carry most of the page.
  • The rule says nothing about accessibility: check every foreground and background pair against WCAG (4.5:1 for normal text, 3:1 for large text and interface components) and expect a raw brand color to fail as a button fill.
  • Encode roles, not hex values: primitive colors, semantic tokens named by job, and components that read only the semantic layer, in CSS custom properties and in a theme.json palette.
  • Build tints and shades in oklch or with color-mix and relative colors, because HSL lightness is uneven across hues and makes contrast unpredictable.
  • Dark mode swaps the values behind the same roles: the accent usually gets lighter, the text on it flips dark, and hover moves the other way.
  • Test with a script for token pairs, real pages in every state, and color-blindness and forced-colors emulation, not by eye on one screen.

What the rule says, and what it does not

The rule describes proportion by role. About 60 percent of the visual area belongs to a dominant color, about 30 percent to a secondary color, and about 10 percent to an accent. Read it as three jobs, because the jobs are what you will implement.

The dominant color is the resting place. It is the page background, the section backgrounds and the cards, usually a light or dark neutral with very little chroma, so that content is what people look at. The secondary color builds structure: header and footer bands, sidebars, panels, borders, headings and body text. It is where the brand personality lives when the brand color is deep or muted. The accent is the scarce color, the one with the most chroma and the strongest contrast against the other two. It marks primary buttons, the links that matter, active navigation, small badges and the one number on a page you want read first.

Why does proportion work at all? Because attention is relative. The eye goes to what differs from its surroundings, and a color can only differ if its surroundings are mostly something else. An orange button that covers 2 percent of the screen on a calm background is found in a glance. The same orange covering a third of the screen is wallpaper, and the button disappears into it. Scarcity is the mechanism, and 10 percent is a convenient upper bound for how scarce is scarce enough.

Four misreadings cause most bad palettes.

  • It is not three hex codes. Each role is a family: a dominant that includes a surface and a slightly darker raised surface, a secondary with a text shade and a band shade, an accent with a hover shade. Three hues, many values.
  • The 60 is rarely a hue. On most healthy sites it is a neutral: white, off-white, near-black or a tinted gray. Treat the percentages as a ratio of quiet to loud, not of red to blue.
  • It is not a law. Anything from 60 to 70 percent dominant, 20 to 30 secondary and 5 to 10 accent behaves the same way. The hierarchy matters, not the arithmetic.
  • It does not cover legibility. The rule is silent about whether the text on your 30 percent band can be read. It is a composition tool, and contrast gets its own section below.

The rule is usually credited to interior design, but nothing here depends on that history. What matters is that it is testable: you can take a screenshot of your own page, count what each color covers, and see whether the picture matches the role. The next section shows how.

Three roles, three jobs

Dominant (about 60)Secondary (about 30)Accent (about 10)
JobCalm the page and carry the contentGive structure and group thingsSay act here, or this matters
Typical web areasPage and section backgrounds, cardsHeader, footer, sidebars, panels, headings, body text, bordersPrimary buttons, key links, active states, badges
Color characterLight or dark neutral, very low chromaMid to deep, often the brand color or its dark shadeHighest chroma, contrasts with both others
If overusedFlat and lifelessHeavy, competes with the accentNoisy, nothing stands out
If missingNo resting place for the eyeLayout feels unstructuredNothing to click, weak hierarchy
The percentages describe how much room each role takes; the rows describe what each role does and how it fails.

Measuring the split on a real web page

A stylesheet does not have a 60-30-10 split; a screen does. The rule is judged on what a visitor sees at one moment, so measure one viewport at a time, at a realistic width, at the top of the page and again after scrolling a screen or two. A site can be right on the home page and wrong three screens down, where a full-width colored band quietly takes over.

A few conventions keep the measurement honest.

  • Surfaces count by area, text counts by role. Letterforms cover little area, so a literal pixel count would call every page 95 percent background. Treat the text color as part of the secondary family instead, since ink and headings do the structural work of the 30.
  • Photographs and video sit outside the rule. They bring their own colors. The rule governs the interface around them, but the dominant hues in your photography should influence the accent you choose, because a green accent beside lush green photos disappears.
  • A hero may be lopsided if the screens around it rebalance.

You can sample a page in the browser rather than guess. Open the developer tools console on the page and run the snippet below. It lays a grid over the viewport, finds the element at each grid point, walks up to the first ancestor with a painted background color, and tallies the results.

const counts = new Map();
const cols = 48;
const rows = 30;
for (let y = 0; y < rows; y++) {
  for (let x = 0; x < cols; x++) {
    let el = document.elementFromPoint(
      ((x + 0.5) * innerWidth) / cols,
      ((y + 0.5) * innerHeight) / rows
    );
    let bg = 'rgba(0, 0, 0, 0)';
    while (el) {
      bg = getComputedStyle(el).backgroundColor;
      if (bg !== 'rgba(0, 0, 0, 0)') break;
      el = el.parentElement;
    }
    counts.set(bg, (counts.get(bg) || 0) + 1);
  }
}
const total = cols * rows;
console.table(
  [...counts]
    .map(([colour, n]) => ({ colour, share: Math.round((n / total) * 100) }))
    .sort((a, b) => b.share - a.share)
);

The output is a table of colors and rough shares. It has limits worth knowing. It reads CSS background colors only, so an image or a gradient is attributed to the solid color behind it. A transparent result means nothing was painted, so the browser default canvas shows through. It samples the current viewport, not the whole page. And the 48 by 30 grid is coarse: fine for telling 60 from 40, useless for 60 from 58. Chrome developer tools also have a CSS Overview panel that lists every color a page uses across the whole document, which is a good way to find the stray fourth gray and the one shade of blue that only an old plugin uses.

Read the numbers for their shape, not their precision. One color clearly ahead, a second well behind it and everything else small is healthy. Two surface colors at roughly 40 percent each means there is no dominant color. An accent above 20 percent is no longer an accent. More than five distinct non-neutral colors in the table usually means a plugin or a pasted block carries its own palette.

Auditing the split on one page

  1. Pick the viewOne viewport at a realistic width, then the next screen down.
  2. Sample the colorsConsole grid or the CSS Overview panel.
  3. Group near-identical valuesFive slightly different grays are one gray with drift.
  4. Name each group by roleDominant, secondary, accent, or unassigned.
  5. Compare to the rangesAbout 60, 30 and 10, with the hierarchy intact.
  6. Fix at the tokenChange the role definition, not the element.
A repeatable audit: sample, group, name by role, compare, then fix tokens rather than individual elements.

Choosing the accent from your brand color

The most common first move is also the most common mistake: take the logo color and flood the page with it. A brand color is an identity, and whether it can serve as the 60, the 30 or the 10 depends on what it looks like on a screen, not on how important the brand feels.

Judge it by three properties. Lightness: dark colors make good text and structure, light colors make good surfaces. Chroma, which is roughly saturation: high chroma grabs attention, which is the accent job, and tires the eye across large areas. Hue and temperature: they decide how the colors relate to each other and to your photography. The decision figure sorts the common cases.

Once the brand color has a role, derive the other two from it. If the brand color becomes the accent, build the 30 from a deep shade of a neighboring hue or from a dark neutral, and the 60 from a tinted off-white. If it becomes the 30, the 60 is a very light tint of the same hue or a neutral, and the accent is a new, more saturated color you add on purpose.

Three simple hue relationships cover most needs. An accent opposite the secondary on the color wheel, for example orange against deep teal, gives the strongest pop and suits pages built around a single conversion. An accent next to the secondary, for example a teal structure with a green-leaning accent, gives a calm, cohesive page where the accent is found by chroma and lightness rather than by hue. An accent that is a lightness flip rather than a hue, such as a white button on a near-black page, is the quietest option and suits editorial and portfolio sites. These are starting points. Wheel geometry predicts nothing about contrast or legibility, which you still have to calculate.

A brand with more than one strong color needs a ranking. One takes the secondary or accent role, and the others are reserved for illustration, charts and large graphics. Two equally loud brand colors in interface roles produce two competing buttons.

Keep status colors separate. Success green, warning amber, error red and info blue sit outside the 60-30-10 budget because they carry meaning, but they must stay distinguishable from the accent. A red or orange accent is the awkward case, because an error message and a primary button start to look related. The fix is redundancy, not a different brand: error states get an icon, a label and a border treatment in addition to the color. You need that anyway for visitors who cannot tell the colors apart.

Which role does the brand color take?

What does your brand color look like next to a plain page background?
Bright and saturated: vivid orange, electric blue, hot pinkMake it the 10. Build the 60 from a tinted off-white and the 30 from a deep neutral or a dark shade of a neighboring hue.
Deep and dark: navy, forest green, burgundyMake it the 30 for header, footer, headings and panels. Add a lighter, more saturated accent in a nearby or opposite hue.
Soft or pale: pastel, cream, sageUse a faint tint as the 60 surface, a deeper shade of the same hue as the 30, and add a separate accent.
Two strong brand colorsGive one the 30 or the 10 and keep the other for illustration. Never give both the same interface weight.
Start from how the brand color behaves on a screen, then fill in the other two roles around it.

Neutrals and tinted grays

Neutrals carry the 60 and much of the 30, so their quality decides how the whole site feels. The usual weak point is a neutral with no relationship to anything else. A pure gray, one with zero chroma, placed next to a colored brand can look faintly dirty. A gray with a small amount of chroma toward the brand hue, or toward a deliberate warm or cool cast, looks intentional.

In oklch terms the tint is tiny. The surfaces in the worked palette use chroma of about 0.01 to 0.02 at a warm hue near 85, and the ink uses about 0.04 at a cool hue near 222. Nobody would call either one beige or blue, yet the page reads as warm paper with cool ink, a classic pairing because the two separate easily. Choose the temperature relationship once and keep every neutral consistent with it. A cold gray border on a warm surface is the kind of mismatch people feel without being able to name.

:root {
  /* surfaces: warm and very light */
  --paper-50: oklch(0.971 0.009 85);
  --paper-100: oklch(0.936 0.016 83);
  --paper-200: oklch(0.866 0.02 85);
  /* mid neutral, used for control borders */
  --stone-500: oklch(0.615 0.019 85);
  /* ink: cool and dark */
  --ink-600: oklch(0.471 0.028 220);
  --ink-900: oklch(0.296 0.037 222);
}

Build the ramp around jobs, not around a numbering scheme: a page surface, a raised surface for cards, a soft divider, a control border, muted text and body text. That is six steps, and most sites need no more. Anything you cannot assign to a job is a stray gray waiting to cause the drift the audit found.

Perceptual lightness makes neutrals easy to reason about. Because oklch lightness tracks how light a color looks, a neutral’s contrast against a surface is predictable from lightness alone. On a light surface near 0.97, a text neutral near 0.5 lands at roughly 5.5:1, while one near 0.55 comes out just under 4.5:1 and one near 0.6 around 3.6:1. Treat that as a rule of thumb for picking starting points and compute the real ratio every time, since hue and chroma shift the result.

Finally, pure white and pure black. A page of pure #FFFFFF with pure #000000 text is legal and sometimes right, but many designers soften it for long reading, because the extreme pair produces glare for some readers. That is a preference, not a rule, and the contrast minimums are floors, not targets.

One neutral ramp, six jobs

How to read this: each row is one option, and its dot shows where it sits between Lightest (surfaces) and Darkest (ink). Placement is an editorial judgement, not a measurement.

  1. 1Page backgroundThe 60, faintly warm
  2. 2Raised cardOne step darker than the page
  3. 3Soft dividerDecorative, no contrast duty
  4. 4Control borderNeeds 3:1 against the surface
  5. 5Muted textNeeds 4.5:1, so keep it dark
  6. 6Body text and headingsWell above the minimum
Each neutral step gets a job; the positions are an editorial sketch of how dark each job sits, not measurements.

Contrast: the part the rule does not cover

Contrast is where palettes that look right fail. WCAG 2 defines the contrast ratio as (L1 + 0.05) divided by (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 that of the darker one. Relative luminance weights the linearized red, green and blue channels by 0.2126, 0.7152 and 0.0722, so green contributes most and blue least. Ratios run from 1:1 for identical colors to 21:1 for black on white.

Level AA asks for 4.5:1 for normal text and 3:1 for large text, which WCAG defines as at least 18 point (24 CSS pixels) regular or 14 point (about 18.66 pixels) bold. Non-text contrast, added in WCAG 2.1, asks for 3:1 for the parts of interface components and graphics that you need in order to identify them: input borders, meaningful icons, chart marks and focus indicators. Level AAA raises normal text to 7:1. Two details matter in practice. The ratio is not rounded, so 4.499:1 fails. And text over a photograph or gradient has to pass at the worst point behind it, not at the average.

A 60-30-10 palette makes the job small. You do not test every color against every other; you test the pairs your roles create: body text on the surface and on the raised surface, muted text on both, the accent as link text on both, the label on each accent button state, text on the structure band, and control borders and focus rings against the surface. That is roughly ten pairs. Watch the second surface in particular. In the worked palette the accent passes on the page at 5.10:1 and on a card at 4.59:1, which is still a pass but with almost no margin.

Then there is the classic failure. The example brand orange is #E4572E. White text on it is 3.68:1 and the dark ink on it is 3.72:1, so neither reaches 4.5:1. As a button fill with a normal-size label it fails whichever way you color the text. The options are to darken the fill, which is what the worked palette does with #B8401A at 5.55:1 against white, to keep the exact brand orange for the logo and large illustration, or to make the label large and bold enough to qualify for 3:1, which is legitimate but fragile when someone later shrinks the font. As a rule, the interface accent is a darker sibling of the brand color, and the exact brand color lives where no text sits on it.

Logos, purely decorative elements and inactive controls are exempt. Do not stretch that into gray placeholder text or faint helper copy, which are real text people need. WCAG 3 is a working draft that explores a different contrast model, commonly called APCA, which treats dark backgrounds and thin type differently. WCAG 2.x ratios are still what most checklists and policies cite, so this guide uses them. This is general orientation, not legal advice, and passing contrast alone does not make a site accessible.

WCAG 2 contrast thresholds at a glance

Ratio neededWhat it covers
Normal text (AA)4.5:1Body copy, labels, link text below the large-text size
Large text (AA)3:124 px regular or about 18.66 px bold and larger
Interface parts (AA)3:1Control borders, meaningful icons, chart marks, focus indicators
Enhanced text (AAA)7:1Optional, a good target for long body copy
ExemptNoneLogos, pure decoration, inactive controls
The minimums most 60-30-10 palettes have to meet at level AA, with the exemptions beside them.

A worked palette, from brand color to final tokens

The example is an invented landscape-design studio. Its logo is orange, #E4572E, and the owner wants the site to feel warm, calm and trustworthy. The steps below are the ones to repeat for any brand.

  1. Assign roles. The orange is saturated, so it is the 10. The 60 is a warm off-white. The 30 is a deep teal plus a dark ink, which also serves as the text color.
  2. Set the neutrals. Page surface #F8F5EF and a raised card surface #EFE9DE. Ink #16313A is 12.58:1 on the page and 11.33:1 on the cards. Muted text #4A5F66 is 6.19:1 and 5.57:1 on the same two surfaces.
  3. Set the secondary. Teal #1F4F5C for header and footer bands. The page color on it is 8.28:1, so band text is comfortable.
  4. Fix the accent. The raw orange fails, as the previous section showed, so the interface accent becomes #B8401A and the hover state #9A3414. White on the accent is 5.55:1, and white on the hover is 7.30:1. The exact orange stays in the logo and in large illustrations.
  5. Set the control border. #8A8478 is 3.41:1 on the page, enough to identify an input field.

Notice how the accent behaves. As link text it is 5.10:1 on the page and 4.59:1 on a card, and it is only 1.62:1 against the teal band, where it is unusable. That tells you something structural: on the 30 band the accent role needs a different value. Roles survive; the particular color assigned to a role can change per context, and the next section shows how to do that without touching a single component.

The resulting first screen is easy to describe. A paper background with ink text fills most of the view, a teal band holds the header, and the only orange is one primary button and a few links. If a sampling audit later shows orange creeping up because someone started coloring headings and icons with it, you have found the drift early.

Two decisions deserve a line each. The brand orange is deliberately kept out of the editor palette as a text or fill choice, or labeled decorative only, because editors will otherwise use it for button labels and fail contrast one page at a time. And status colors are not designed here. In a real project they would get their own tokens, chosen so that error red is not mistaken for the orange accent, and always paired with an icon and a word.

Roles as CSS custom properties: three layers

The most useful structural idea in this guide is a two-layer token system with a third layer on top. Primitive tokens name colors by what they are: paper-50, teal-700, orange-700. Semantic tokens name them by the job they do: surface, text, accent. Components read only the semantic layer. When a component never mentions a primitive, retheming is a change in one place, and the 60-30-10 split becomes enforceable, because you can search the stylesheet for raw colors and treat each hit as a bug.

:root {
  /* 1. primitives: named by what they are */
  --paper-50: #f8f5ef;
  --paper-100: #efe9de;
  --teal-700: #1f4f5c;
  --ink-900: #16313a;
  --ink-600: #4a5f66;
  --stone-500: #8a8478;
  --orange-700: #b8401a;
  --orange-800: #9a3414;

  /* 2. semantic: named by job; components read only these */
  --surface: var(--paper-50);
  --surface-raised: var(--paper-100);
  --structure: var(--teal-700);
  --text: var(--ink-900);
  --text-muted: var(--ink-600);
  --accent: var(--orange-700);
  --accent-hover: var(--orange-800);
  --on-accent: #ffffff;
  --control-border: var(--stone-500);
  --focus-ring: var(--teal-700);
}

Custom properties inherit, and that gives you the best trick in the system: re-theme a region by redefining the semantic tokens on its container. The teal band cannot use the normal accent, as the worked palette showed, so give it its own values and let every button and link inside follow.

.band {
  --surface: var(--teal-700);
  --text: var(--paper-50);
  --text-muted: var(--paper-100);
  --accent: var(--paper-50);
  --accent-hover: var(--paper-100);
  --on-accent: var(--ink-900);
  background: var(--surface);
  color: var(--text);
}

Inside .band a primary button is now a paper-colored pill with ink text, 12.58:1 inside the button and 8.28:1 against the teal behind it. No component changed. This is how a 60-30-10 system handles dark footers, promo strips and dark cards without inventing a fourth and fifth color.

Where the CSS lives in WordPress depends on your theme. In a block theme it can go in the theme stylesheet or in the Site Editor additional CSS area under Styles. In a classic theme it goes in the child theme stylesheet or the Customizer additional CSS box. One caution: a var() reference to an undefined property makes the declaration invalid at computed-value time, and the property silently falls back to its inherited or initial value, so a typo in a token name shows up as a missing color rather than an error.

The token layers, top to bottom

Components and pagesButtons, cards, headers. They read semantic tokens and never contain a hex value.
Context and mode overridesA dark band, dark mode, high contrast. They redefine semantic values, not components.
Semantic tokenssurface, text, accent, on-accent. Named by job, so they survive a rebrand.
Primitive palettepaper-50, teal-700, orange-700. The only layer that holds raw color values.
Components read semantic tokens, mode overrides swap their values, and only the bottom layer holds raw colors.

With the tokens in place, applying the rule is a short list of decisions. Backgrounds take the surface, with cards on the raised surface. Paragraphs take the text token and secondary copy the muted one. The accent never colors paragraphs or headings, because the moment it does it stops meaning act here. Links take the accent and keep an underline, since WCAG asks that color is not the only way a link is told apart from the text around it, and an underline is the simplest way to comply. Each view gets one primary button in the accent fill, secondary actions are outlined in the text color, and tertiary actions are plain links.

body { background: var(--surface); color: var(--text); }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }

.button {
  background: var(--accent);
  color: var(--on-accent);
  border: 2px solid transparent;
  padding: 0.7em 1.2em;
  border-radius: 0.4em;
}
.button:hover { background: var(--accent-hover); }
.button--secondary { background: transparent; color: var(--text); border-color: var(--text); }
.button:disabled { background: var(--surface-raised); color: var(--text-muted); }

:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

input, select, textarea { border: 1px solid var(--control-border); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

A few details are worth the extra line each. Hover moves one step along the same hue, darker in light mode, and does not change hue. Focus gets its own token, a ring of two or three pixels rather than a hairline, and a gap from the element, so the ring has the page behind it and only needs 3:1 against that. The transparent border on buttons costs nothing visually, but in forced-colors modes such as Windows high contrast, where the browser replaces your colors, it becomes a visible outline, so the button keeps its shape. The accent-color property recolors native checkboxes, radios and ranges and lets the browser choose a legible mark. And :visited styling is limited by browsers to color-related properties for privacy reasons, so do not plan a design that depends on a distinct visited color. State changes also should not rely on color alone: an error needs text and an icon, a selected tab needs a shape or weight change.

generatepress.com
The GeneratePress home page: a near-black page with a white headline and white rounded buttons, and below it a sample store site on a cream background with a photograph and a single dark button.
A restrained palette in the wild: one dominant surface, white buttons on near-black, and a sample site on cream whose only strong element is a single dark button.

Putting the palette into theme.json

In a block theme, theme.json is the natural home for the palette, because it feeds the editor color pickers, the front end and the generated CSS at once. Each entry in settings.color.palette has a slug, a display name and a color. WordPress turns every entry into a CSS custom property named –wp–preset–color–slug, and into classes such as has-slug-color and has-slug-background-color that blocks use when an editor picks a swatch.

{
  "version": 3,
  "settings": {
    "color": {
      "defaultPalette": false,
      "defaultGradients": false,
      "defaultDuotone": false,
      "palette": [
        { "slug": "base", "name": "Base (page background)", "color": "#F8F5EF" },
        { "slug": "base-raised", "name": "Base raised (cards)", "color": "#EFE9DE" },
        { "slug": "structure", "name": "Structure (bands, panels)", "color": "#1F4F5C" },
        { "slug": "contrast", "name": "Contrast (text)", "color": "#16313A" },
        { "slug": "muted", "name": "Muted (secondary text)", "color": "#4A5F66" },
        { "slug": "accent", "name": "Accent (buttons, links)", "color": "#B8401A" },
        { "slug": "accent-strong", "name": "Accent hover", "color": "#9A3414" },
        { "slug": "on-accent", "name": "On accent (button text)", "color": "#FFFFFF" }
      ]
    }
  },
  "styles": {
    "color": {
      "background": "var(--wp--preset--color--base)",
      "text": "var(--wp--preset--color--contrast)"
    },
    "elements": {
      "link": {
        "color": { "text": "var(--wp--preset--color--accent)" },
        ":hover": { "color": { "text": "var(--wp--preset--color--accent-strong)" } }
      },
      "button": {
        "color": {
          "background": "var(--wp--preset--color--accent)",
          "text": "var(--wp--preset--color--on-accent)"
        },
        ":hover": {
          "color": {
            "background": "var(--wp--preset--color--accent-strong)",
            "text": "var(--wp--preset--color--on-accent)"
          }
        }
      }
    }
  }
}

Make the choices on purpose. Name slugs by role, so base and accent survive a rebrand and orange does not. Write display names that tell editors where a swatch belongs, and list the swatches in 60, 30, 10 order, since the picker shows them as given. Turning off the default palette, gradients and duotones stops core swatches from competing with yours. Setting color.custom to false removes arbitrary color picking, which enforces the rule but is a real trade-off if editors legitimately need freedom. Version 3 of the file format needs WordPress 6.6 or later, so use 2 on older sites.

Two behaviors surprise people. Preset classes are output with !important, so overriding has-accent-background-color from your own CSS is a fight; change the variable instead. And colors edited in the Site Editor Styles panel are stored in the database as user data and override the file, so when the editor and the file disagree, look at the user layer first. For custom CSS outside blocks, bridge the presets to your short semantic names on body rather than :root, because WordPress has printed preset variables on different selectors in different versions and body sees both:

body {
  --surface: var(--wp--preset--color--base);
  --text: var(--wp--preset--color--contrast);
  --accent: var(--wp--preset--color--accent);
  --on-accent: var(--wp--preset--color--on-accent);
}

A classic theme can register the same swatches in PHP, although it can also ship a theme.json file.

add_action( 'after_setup_theme', function () {
	add_theme_support(
		'editor-color-palette',
		array(
			array( 'name' => __( 'Base', 'my-theme' ), 'slug' => 'base', 'color' => '#F8F5EF' ),
			array( 'name' => __( 'Accent', 'my-theme' ), 'slug' => 'accent', 'color' => '#B8401A' ),
		)
	);
	add_theme_support( 'disable-custom-colors' );
} );

If a page builder or CSS framework also keeps a global palette, choose one owner for the hex values and make the others reference variables. Otherwise the same orange exists in three places and drifts in all three.

From theme.json to the page

  1. Palette in theme.jsonSlug, display name, color value.
  2. Variables printed–wp–preset–color–slug on the page.
  3. Block classeshas-slug-color and has-slug-background-color.
  4. Styles set defaultsBody, links and buttons read the variables.
  5. Site Editor editsStored in the database, override the file.
One palette definition fans out into variables, classes and defaults, and Site Editor edits layer on top.

Tints and shades in code: oklch, color-mix and relative colors

HSL is familiar but misleading for ramps, because its lightness is not perceptual. hsl(60 100% 50%) is pure yellow, with a contrast ratio of about 1.07:1 against white, while hsl(220 100% 50%) is a vivid blue at about 5.6:1. Same lightness number, nearly opposite contrast. A ramp built by stepping HSL lightness therefore has hue-dependent, uneven contrast. In oklch, L runs from 0 to 1 and tracks perceived lightness, C is chroma and H is the hue angle. Hold the hue fixed, step L, and ease off chroma at the extremes, because very light and very dark colors cannot carry much chroma inside the sRGB range. Values outside it are mapped by the browser, which can dull or shift the result.

:root {
  --accent-h: 37;
  --accent-50: oklch(0.97 0.012 var(--accent-h));
  --accent-100: oklch(0.93 0.03 var(--accent-h));
  --accent-300: oklch(0.82 0.1 var(--accent-h));
  --accent-500: oklch(0.64 0.18 var(--accent-h));
  --accent-700: oklch(0.54 0.16 var(--accent-h));
  --accent-800: oklch(0.47 0.14 var(--accent-h));
  --accent-900: oklch(0.36 0.09 var(--accent-h));
}

Step 500 lands close to the brand orange, and steps 700 and 800 land close to the interface accent and hover color in the worked palette. Two other functions derive colors without a hand-built ramp. color-mix blends two colors in a chosen space, which suits washes such as a highlighted row or an info box. Relative color syntax rewrites one channel of an existing color, which suits pressed states.

:root {
  --accent-wash: color-mix(in oklch, var(--accent) 12%, var(--surface));
}
@supports (color: oklch(from red l c h)) {
  :root {
    --accent-pressed: oklch(from var(--accent) calc(l - 0.07) c h);
  }
}

Support is good in current evergreen browsers but newer for relative colors, so check a compatibility table for your audience. For older browsers, note one trap: a custom property accepts any token stream, so declaring a token with an unsupported oklch value does not fall back by the cascade. The property is simply invalid when used. Define a hex value first and override it inside an @supports (color: oklch(0.5 0.1 30)) block, and keep hex in theme.json, since editor pickers and checkers may not parse newer syntaxes. Derived colors also need rechecking: accent text on its own 12 percent wash has less contrast than on the plain surface.

If you would rather manage a palette in a visual tool, Core Framework, which its own site describes as a free, open source CSS framework with a visual manager for colors and typography, works across WordPress, Gutenberg and several builders.

coreframework.com
The Core Framework home page on a dark background with the headline Your Design System Now Open Source and download buttons, above a preview of its editor showing Colors and Typography sections.
Core Framework presents palette and type management as a visual editor, one way to generate and maintain color variables without hand-writing them.

Dark mode without breaking the rule

Dark mode keeps the roles and swaps the values behind them. The 60 becomes a dark surface. The 30 becomes the raised surfaces and panels, which are lighter than the page, because in a dark interface elevation reads as lightness. The accent keeps its hue, and the details around it change.

The accent usually gets lighter, and the text on it flips from white to dark. In the worked palette, #FF8A5C on the dark surface #0F1B1F is 7.55:1, and the dark surface color on that accent is also 7.55:1. The light-mode accent #B8401A would be only 3.16:1 on the dark surface, which fails for text. Even the raw brand orange, #E4572E, which failed on white, reaches 4.76:1 on that dark surface. Hover moves the other way: lighter, not darker.

Avoid pure black and pure white as the main pair, because bright text on pure black glows and can smear for some readers. Keep surface chroma low, since large saturated dark areas vibrate. Shadows disappear on dark surfaces, so use a lighter surface step for elevation. And check images: a logo with dark lettering on a transparent background vanishes, so supply a light variant.

:root {
  color-scheme: light dark;
  --surface: light-dark(#f8f5ef, #0f1b1f);
  --surface-raised: light-dark(#efe9de, #17262b);
  --structure: light-dark(#1f4f5c, #1d4350);
  --text: light-dark(#16313a, #ece8df);
  --text-muted: light-dark(#4a5f66, #a8b5b8);
  --accent: light-dark(#b8401a, #ff8a5c);
  --accent-hover: light-dark(#9a3414, #ffa27d);
  --on-accent: light-dark(#ffffff, #0f1b1f);
  --control-border: light-dark(#8a8478, #6f8288);
  --focus-ring: light-dark(#1f4f5c, #ece8df);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

The color-scheme property tells the browser to draw built-in interface such as form controls and scrollbars to match, and light-dark() picks a value by scheme. It is supported in current browsers from 2024 onward, so for older ones write the dark values in a prefers-color-scheme media query instead. A manual toggle only has to set the data-theme attribute, and it should do so in an inline script in the head, before first paint, or visitors see a flash of the wrong theme.

WordPress has no built-in dark switch in theme.json. You can ship a style variation that visitors or editors choose, or override the preset variables in CSS. The selector below is deliberately a little more specific than the single-element selector WordPress has used for presets, so load order stops mattering; confirm in your page source.

@media (prefers-color-scheme: dark) {
  html body {
    --wp--preset--color--base: #0f1b1f;
    --wp--preset--color--base-raised: #17262b;
    --wp--preset--color--structure: #1d4350;
    --wp--preset--color--contrast: #ece8df;
    --wp--preset--color--muted: #a8b5b8;
    --wp--preset--color--accent: #ff8a5c;
    --wp--preset--color--accent-strong: #ffa27d;
    --wp--preset--color--on-accent: #0f1b1f;
  }
}

Testing the palette on real pages

Start with numbers, because they are cheap and repeatable. Save the script below as check-contrast.js and run it with Node. It computes the WCAG ratio for each pair your roles create and exits with an error if any pair misses its minimum, so it can run before every release. Add the dark-mode pairs as a second list.

const pairs = [
  ['text on surface', '#16313a', '#f8f5ef', 4.5],
  ['text on raised surface', '#16313a', '#efe9de', 4.5],
  ['muted text on surface', '#4a5f66', '#f8f5ef', 4.5],
  ['accent link on surface', '#b8401a', '#f8f5ef', 4.5],
  ['accent link on raised surface', '#b8401a', '#efe9de', 4.5],
  ['label on accent button', '#ffffff', '#b8401a', 4.5],
  ['label on hovered button', '#ffffff', '#9a3414', 4.5],
  ['text on structure band', '#f8f5ef', '#1f4f5c', 4.5],
  ['control border on surface', '#8a8478', '#f8f5ef', 3],
];

const channel = (c) => (c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
const luminance = (hex) => {
  const [r, g, b] = hex.slice(1).match(/../g).map((h) => channel(parseInt(h, 16) / 255));
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
};
const ratio = (a, b) => {
  const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
  return (hi + 0.05) / (lo + 0.05);
};

let failed = false;
for (const [name, fg, bg, min] of pairs) {
  const r = ratio(fg, bg);
  if (r < min) failed = true;
  console.log((r < min ? 'FAIL ' : 'pass ') + r.toFixed(2) + '  ' + name);
}
process.exit(failed ? 1 : 0);

The numbers quoted in this guide come from exactly this formula. Then look at real pages, because a table of pairs cannot see a gradient or a photograph. Check a long article, a form with validation errors, a data table, a card grid and a hero with text over an image. Use the developer tools to force hover, focus and active states on real elements. In Chrome, the color picker shows the contrast ratio against the detected background, the CSS Overview panel lists low-contrast text, and a Lighthouse accessibility audit flags many failures. Treat these as a floor: automated tools cannot judge text over images or gradients.

For color vision, open the Rendering panel in Chrome developer tools and use the option to emulate vision deficiencies, which previews protanopia, deuteranopia, tritanopia, achromatopsia and blurred vision. Red-green deficiencies affect a meaningful share of men, commonly cited at several percent in many populations. The achromatopsia view doubles as a grayscale test: the primary button should still be the most prominent control, which means the accent has to differ from its neighbors in lightness and not only in hue. The same panel can emulate prefers-color-scheme and forced colors, so check dark mode and high-contrast rendering too, then zoom to 200 percent and view the page on a phone at low brightness. Simulations catch a lot, but real users and assistive-technology checks catch more.

Common mistakes and how to recognize them

Palettes rarely fail in the abstract. They fail with a visible symptom, and the symptom usually points to one cause.

  • Everything looks equally important. The sampling audit shows two surface colors near 40 percent each, or an accent above 20. Neither has a dominant role. Demote one surface to a neutral or shrink the accent to buttons and links.
  • Buttons pass on the home page and fail on cards. Contrast was tested against one background. List pairs for every surface, band and card, and rerun the script.
  • Editor-built pages drift off brand. Arbitrary color pickers are on and people type hex values into blocks. Restrict pickers to the palette where that fits, and look for stale block-level colors.
  • The colors changed after a theme or builder update. The palette lives in several places. Pick one owner and have the rest reference variables.
  • Gray text and borders look dull beside the brand. Pure grays sit next to colored neutrals. Tint the ramp.
  • The grayscale view looks flat. The accent differs from its neighbors only in hue. Give it a lightness difference too.
  • Dark mode glows or vibrates. Light-mode saturation and pure white text were copied across. Lower surface chroma and soften the text.
  • The percentages become a pass or fail test. They are a diagnostic. A photography-led portfolio can be mostly image, and a brand built on one saturated color can legitimately give it a larger share on a landing page. Bend the rule on purpose, then confirm that hierarchy and contrast still hold.
  • Status messages look like buttons. Error red or success green sits too close to the accent. Choose distinct hues and always add an icon and a word.
  • Hero text passes on one photo and fails on the next. Contrast over an image has to hold at its worst point. Put a solid or gradient overlay behind the text, or set it on a panel from the surface token.

The common thread is that every one of these is cheap to fix at the role level and expensive to fix element by element, which is the case for the token layers earlier in this guide.

Checklist

  • Write down the three roles, surface, structure and accent, before choosing any hex values.
  • Decide the brand color’s role from its lightness and chroma, not from how important it feels.
  • Keep one accent, and rank any other brand colors for illustration only.
  • Tint every neutral slightly toward the brand hue or one chosen warm or cool cast.
  • Limit the neutral ramp to named jobs: surface, raised surface, divider, control border, muted text and text.
  • List every foreground and background pair your roles create, including cards and bands.
  • Confirm 4.5:1 for normal text, 3:1 for large text, and 3:1 for control borders, icons and focus rings.
  • Derive a darker interface accent if the raw brand color fails as a button fill.
  • Keep raw color values in one primitive layer and let components read semantic tokens only.
  • Give dark bands and cards semantic overrides instead of extra colors.
  • Add the palette to theme.json by role, and decide whether editors may pick custom colors.
  • Make one tool, theme.json, a builder or a framework, the owner of the color values.
  • Underline body links, and give focus, error and selected states a cue beyond color.
  • Build dark mode by swapping values behind the same roles, then recheck every pair.
  • Run the contrast script and the viewport sampling audit after every palette change.
  • Preview color-vision deficiencies, forced colors and prefers-color-scheme before launch.

About this guide. This is general guidance written by WPresident Editorial from documentation and widely used practice. WPresident has not benchmarked the products or methods described. Interfaces and plan limits change, so check the vendor’s current documentation before you act. Not legal, tax or financial advice. See our editorial policy.

Frequently asked questions

Is the 60-30-10 rule a real design standard?

No. It is a rule of thumb borrowed from interior design, and no web specification, WordPress setting or accessibility guideline requires it. Its value is practical: it makes you give each color a role and keeps the loudest color scarce. Treat the percentages as ranges, roughly 60 to 70, 20 to 30 and 5 to 10, and judge the result by hierarchy rather than arithmetic.

Does it mean exactly 60 percent of the pixels?

No. It describes visual weight across a view, and a rough sample is enough. Photographs and video sit outside it, text counts by role rather than area, and a hero section can skew one screen on purpose. If one color clearly leads, a second sits well behind and the accent stays small, you are inside the spirit of the rule even at 70-25-5.

Can the dominant color be white or black?

Yes, and it often should be. The 60 is usually a neutral, and white, off-white, near-black or a tinted gray all work. A slight tint toward the brand hue tends to look more deliberate than pure white or pure black, but that is a taste choice. What matters is that the accent contrasts with it and the text clears the contrast minimum.

My brand color fails contrast on buttons. What should I do?

Keep the exact brand color for the logo and large graphics, and derive a darker interface accent from it, same hue and lower lightness, until the label reaches 4.5:1. Check hover and pressed states separately. In the worked example, white text on the orange #E4572E gave 3.68:1, while the darker #B8401A gave 5.55:1.

What if my logo has several colors?

Rank them. Pick one for the accent or the secondary role and reserve the others for illustration, charts and large graphics. Two equally loud brand colors used as interface roles produce competing buttons. If every logo color is loud, add a neutral to carry the 60 and let the logo be the one place the full palette appears.

What contrast do buttons and links need?

Button labels and link text are normal text unless large, so they need 4.5:1 at level AA, or 3:1 if the text is at least 24 px regular or about 18.66 px bold. Control borders, meaningful icons and focus indicators need 3:1. Links should also differ from surrounding text by more than color, for example an underline.

How does the rule work in dark mode?

The roles stay and the values swap. The 60 becomes a dark surface, the 30 becomes lighter raised surfaces, and the accent gets lighter with dark text on it. Hover usually moves lighter instead of darker, and pure black with pure white is best avoided. Define roles as semantic tokens so one override layer, not every component, handles the switch.

Can I use oklch values in theme.json?

The file takes color strings, but editor tools such as swatch pickers and contrast warnings may not parse newer syntaxes everywhere, and behavior varies by WordPress version. The conservative route is hex in theme.json and oklch in your own CSS, with hex fallbacks where older browsers matter. Test in the editor you actually ship, not only on the front end.

How do I check a palette for color blindness?

In Chrome developer tools, open the Rendering panel and use the emulate vision deficiencies option to preview protanopia, deuteranopia, tritanopia and achromatopsia. Check that the primary button is still the most prominent element, that links are distinguishable without hue, and that status messages carry text and icons. Simulations help, but real users and assistive technology catch more.

Should I use WCAG 3 or APCA instead of the WCAG 2 ratios?

For now, WCAG 2.x ratios are what most checklists and policies cite, and WCAG 3 is still a working draft. APCA models perceived contrast differently and can disagree with 2.x, especially on dark backgrounds and thin type. Meet the 2.x minimums, then treat larger sizes and heavier weights as extra margin. Check which version your own requirements name. This is not legal advice.

W
Written byWPresident EditorialThe WPresident editorial team. Every article says whether it comes from hands-on use or from documentation, and anything paid for is labelled.

Keep reading

Get the Monthly Launch Report

One email a month: the best of last month's articles, new reviews and what changed in WordPress, without the noise.

No spam. Unsubscribe in one click.

Signed and sealed,
The WPresident
↑↓ move↵ openEsc closeAll results