Skip to content

Theming

A theme has one token source. Components use role names from that source. The editor and the front end resolve the same names to the same values.

The palette, font families, font sizes, and spacing scale live in theme.json. CSS refers to those presets:

theme.css
color: var(--wp--preset--color--ink);
background: var(--wp--preset--color--canvas);
font-family: var(--wp--preset--font-family--body);
theme.json
{
"settings": {
"color": {
"palette": [
{ "name": "Ink", "slug": "ink", "color": "#1e1e1e" },
{ "name": "Canvas", "slug": "canvas", "color": "#fafafa" }
]
}
}
}

A token name is a role (ink, canvas, brand, accent), not the raw value. A scale step such as green-500 stays inside the token file. Components use the role.

Background, text, border, and focus ring are separate roles when the values differ. A green that works as a large fill often fails as 16px text on white. Those are two tokens.

A utility framework, when one is in use, maps these same values and does not invent a second palette. The framework’s default colours, fonts, and sizes are cleared so only the theme’s tokens exist.

A classic theme that is mostly utility classes in PHP may keep the raw values in CSS. theme.json still lists that same palette. Layout widths (contentSize, wideSize) sit in theme.json with the type scale.