fix: stop the text palette slug from hijacking every custom colour

theme.json shipped a palette entry with the slug "text", so WordPress
generated `.has-text-color { color: var(--wp--preset--color--text)
!important }`. The block editor puts that same class on any block given a
custom text colour, so the rule overrode every one of them site-wide with
the dark-theme foreground, unreadable in either theme. An !important
declaration beats an inline style, which is why the colour set on the
block never had a chance.

Rename the slug to "foreground". No published content used the class, for
the obvious reason that it never worked, so nothing has to be migrated.
A smoke test now rejects any palette slug that shadows an editor utility
class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
chrnxandClaude Opus 5 committed 2026-08-14 10:21:23 -05:00
1 parent 13a8b0425f
commit 6dc4de6b8e
27 files changed
+308 -185

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ html {
body {
margin: 0;
background: var(--wp--preset--color--night);
color: var(--wp--preset--color--text);
color: var(--wp--preset--color--foreground);
overflow-wrap: break-word;
}
+2 -2
View File
@@ -126,7 +126,7 @@ html[data-theme="light"] header.wp-block-template-part {
.chrnx-theme-control > [data-chrnx-theme-button]:hover,
.chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
color: var(--wp--preset--color--text);
color: var(--wp--preset--color--foreground);
opacity: 1;
}
@@ -260,7 +260,7 @@ html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button][aria-e
/* Quiet chip, full-contrast label: accent-on-accent fails WCAG AA. */
.chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
color: var(--wp--preset--color--text);
color: var(--wp--preset--color--foreground);
opacity: 1;
}
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/featured-stories",
"version": "0.4.2",
"version": "0.4.3",
"title": "Featured Stories",
"category": "theme",
"description": "A sticky-led selection of topic-diverse stories.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/footer-content",
"version": "0.4.2",
"version": "0.4.3",
"title": "CHRNX Footer Content",
"category": "theme",
"description": "Display translated internal footer navigation and site credit.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/header-tools",
"version": "0.4.2",
"version": "0.4.3",
"title": "CHRNX Header Tools",
"category": "theme",
"description": "Display translated primary navigation and progressive site search.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-link",
"version": "0.4.2",
"version": "0.4.3",
"title": "Journal Link",
"category": "theme",
"description": "Display a translated portable link to the full Journal.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-stream",
"version": "0.4.2",
"version": "0.4.3",
"title": "Journal Stream",
"category": "theme",
"description": "The filterable chronological journal.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/latest-podcast",
"version": "0.4.2",
"version": "0.4.3",
"title": "Latest Podcast",
"category": "theme",
"description": "A linked card for the latest podcast episode.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/mobile-menu-toggle",
"version": "0.4.2",
"version": "0.4.3",
"title": "CHRNX Mobile Menu Toggle",
"category": "theme",
"description": "Progressively reveal the primary navigation on small screens.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/podcast-meta",
"version": "0.4.2",
"version": "0.4.3",
"title": "Podcast Metadata",
"category": "theme",
"description": "Safe episode details for the current post.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/reading-time",
"version": "0.4.2",
"version": "0.4.3",
"title": "Reading Time",
"category": "theme",
"description": "Display a localized estimate based on the current post content.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/related-posts",
"version": "0.4.2",
"version": "0.4.3",
"title": "Related Posts",
"category": "theme",
"description": "Related stories selected by topic, tags, and recency.",
+1 -1
View File
@@ -2,7 +2,7 @@
--chrnx-related-gap: var(--wp--preset--spacing--40, 1.5rem);
--chrnx-related-control-background: var(--wp--preset--color--panel);
--chrnx-related-control-border: var(--wp--preset--color--muted);
--chrnx-related-control-text: var(--wp--preset--color--text);
--chrnx-related-control-text: var(--wp--preset--color--foreground);
--chrnx-related-focus-ring: var(--wp--preset--color--green);
max-width: 100%;
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/release-detail",
"version": "0.4.2",
"version": "0.4.3",
"title": "Release Detail",
"category": "theme",
"description": "Album cover, listening links, and the ordered tracklist.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/release-list",
"version": "0.4.2",
"version": "0.4.3",
"title": "Release List",
"category": "theme",
"description": "The No Names releases, each linking to its album page.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/selected-work",
"version": "0.4.2",
"version": "0.4.3",
"title": "Selected Work",
"category": "theme",
"description": "Hand-picked projects first, then the most recent ones.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/show-links",
"version": "0.4.2",
"version": "0.4.3",
"title": "Show Links",
"category": "theme",
"description": "Where a podcast show can be listened to, rendered only when a URL exists.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/site-brand",
"version": "0.4.2",
"version": "0.4.3",
"title": "CHRNX Site Brand",
"category": "theme",
"description": "Display the local CHRNX wordmark linked to the site home.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/subscribe-cta",
"version": "0.4.2",
"version": "0.4.3",
"title": "Subscribe CTA",
"category": "theme",
"description": "A call to action linked to the configured subscribe page.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/subscribe-form",
"version": "0.4.2",
"version": "0.4.3",
"title": "Subscribe Form",
"category": "theme",
"description": "The email subscription form, rendered only when a provider endpoint is configured.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/theme-toggle",
"version": "0.4.2",
"version": "0.4.3",
"title": "Theme Toggle",
"category": "theme",
"description": "Choose a light, dark, or system color theme.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/topic-hero",
"version": "0.4.2",
"version": "0.4.3",
"title": "Topic Hero",
"category": "theme",
"description": "A fixed-art hero for an editorial topic.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/track-meta",
"version": "0.4.2",
"version": "0.4.3",
"title": "Track Meta",
"category": "theme",
"description": "Player, listening links, and album for one song.",
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
define( 'CHRNX_VERSION', '0.4.2' );
define( 'CHRNX_VERSION', '0.4.3' );
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'project-meta', 'release-meta', 'show-meta', 'track-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) {
+1 -1
View File
@@ -3,6 +3,6 @@ Theme Name: CHRNX
Description: A native block theme for chrnx.dev.
Requires at least: 6.9
Requires PHP: 8.1
Version: 0.4.2
Version: 0.4.3
Text Domain: chrnx
*/
+17 -1
View File
@@ -112,7 +112,7 @@ test('theme.json exposes the complete dark and warm-light palette with stable se
panel: '#161B22',
violet: '#7C6CF0',
green: '#5FB88A',
text: '#E6EDF3',
foreground: '#E6EDF3',
muted: '#8B949E',
paper: '#F6F2E9',
surface: '#FFFDF7',
@@ -126,6 +126,22 @@ test('theme.json exposes the complete dark and warm-light palette with stable se
assert.deepEqual(palette, expectedTokens);
});
test('no palette slug collides with a block editor utility class', async () => {
const theme = JSON.parse(await readProjectFile('theme.json'));
/*
* WordPress emits `.has-<slug>-color { color: ... !important }` for every
* palette entry. The editor adds the class `has-text-color` to any block
* carrying a custom text colour, so a slug named "text" produced a rule
* that overrode every custom colour on the site with the preset value.
*/
const reserved = new Set(['text', 'background', 'link']);
const collisions = theme.settings.color.palette
.map(({ slug }) => slug)
.filter((slug) => reserved.has(slug));
assert.deepEqual(collisions, []);
});
test('the local Zen Maru Gothic files and license are present', async () => {
await Promise.all([
'assets/fonts/zen-maru-gothic-latin-500.woff2',
+265 -158
View File
@@ -1,160 +1,267 @@
{
"$schema": "https://schemas.wp.org/wp/6.9/theme.json",
"version": 3,
"settings": {
"appearanceTools": true,
"color": {
"defaultPalette": false,
"palette": [
{ "slug": "night", "color": "#0D1117", "name": "Night" },
{ "slug": "panel", "color": "#161B22", "name": "Panel" },
{ "slug": "violet", "color": "#7C6CF0", "name": "Violet" },
{ "slug": "green", "color": "#5FB88A", "name": "Green" },
{ "slug": "text", "color": "#E6EDF3", "name": "Text" },
{ "slug": "muted", "color": "#8B949E", "name": "Muted" },
{ "slug": "paper", "color": "#F6F2E9", "name": "Paper" },
{ "slug": "surface", "color": "#FFFDF7", "name": "Surface" },
{ "slug": "ink", "color": "#25221F", "name": "Ink" },
{ "slug": "light-muted", "color": "#625C54", "name": "Light Muted" },
{ "slug": "light-violet", "color": "#674CA4", "name": "Light Violet" },
{ "slug": "light-green", "color": "#327854", "name": "Light Green" },
{ "slug": "border", "color": "#DED6C7", "name": "Border" }
]
},
"layout": {
"contentSize": "720px",
"wideSize": "1120px"
},
"spacing": {
"defaultSpacingSizes": false,
"spacingSizes": [
{ "slug": "20", "size": "clamp(0.5rem, 0.4rem + 0.4vw, 0.75rem)", "name": "2XS" },
{ "slug": "30", "size": "clamp(0.75rem, 0.6rem + 0.6vw, 1rem)", "name": "XS" },
{ "slug": "40", "size": "clamp(1rem, 0.8rem + 0.8vw, 1.5rem)", "name": "Small" },
{ "slug": "50", "size": "clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem)", "name": "Medium" },
{ "slug": "60", "size": "clamp(2.25rem, 1.6rem + 2vw, 3.5rem)", "name": "Large" },
{ "slug": "70", "size": "clamp(3rem, 2rem + 3vw, 5rem)", "name": "XL" }
],
"units": [ "px", "rem", "em", "%", "vw", "vh" ]
},
"typography": {
"defaultFontSizes": false,
"fluid": true,
"fontFamilies": [
{
"slug": "body",
"name": "System UI",
"fontFamily": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif"
},
{
"slug": "heading",
"name": "Zen Maru Gothic",
"fontFamily": "\"Zen Maru Gothic\", sans-serif",
"fontFace": [
{
"fontFamily": "Zen Maru Gothic",
"fontStyle": "normal",
"fontWeight": "500",
"fontDisplay": "swap",
"src": [ "file:./assets/fonts/zen-maru-gothic-latin-500.woff2" ]
},
{
"fontFamily": "Zen Maru Gothic",
"fontStyle": "normal",
"fontWeight": "700",
"fontDisplay": "swap",
"src": [ "file:./assets/fonts/zen-maru-gothic-latin-700.woff2" ]
}
]
},
{
"slug": "metadata",
"name": "System Monospace",
"fontFamily": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
}
],
"fontSizes": [
{ "slug": "small", "size": "clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem)", "name": "Small" },
{ "slug": "medium", "size": "clamp(1rem, 0.95rem + 0.2vw, 1.125rem)", "name": "Medium" },
{ "slug": "large", "size": "clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem)", "name": "Large" },
{ "slug": "x-large", "size": "clamp(1.75rem, 1.35rem + 1.6vw, 2.75rem)", "name": "Extra Large" },
{ "slug": "display", "size": "clamp(2.5rem, 1.7rem + 3.2vw, 4.75rem)", "name": "Display" }
]
}
},
"styles": {
"color": {
"background": "var:preset|color|night",
"text": "var:preset|color|text"
},
"spacing": {
"blockGap": "var:preset|spacing|50"
},
"typography": {
"fontFamily": "var:preset|font-family|body",
"fontSize": "var:preset|font-size|medium",
"lineHeight": "1.65"
},
"elements": {
"button": {
"color": {
"background": "var:preset|color|green",
"text": "var:preset|color|night"
},
"typography": {
"fontWeight": "700"
}
},
"heading": {
"color": {
"text": "var:preset|color|text"
},
"typography": {
"fontFamily": "var:preset|font-family|heading",
"fontWeight": "700",
"lineHeight": "1.2"
}
},
"link": {
"color": {
"text": "var:preset|color|violet"
},
"typography": {
"textDecoration": "underline"
}
}
},
"blocks": {
"core/button": {
"border": {
"radius": "0.35rem"
}
},
"core/post-date": {
"color": {
"text": "var:preset|color|muted"
},
"typography": {
"fontFamily": "var:preset|font-family|metadata",
"fontSize": "var:preset|font-size|small"
}
},
"core/post-terms": {
"color": {
"text": "var:preset|color|muted"
},
"typography": {
"fontFamily": "var:preset|font-family|metadata",
"fontSize": "var:preset|font-size|small"
}
},
"core/quote": {
"border": {
"color": "var:preset|color|violet",
"style": "solid",
"width": "0 0 0 3px"
}
}
}
}
"$schema": "https://schemas.wp.org/wp/6.9/theme.json",
"version": 3,
"settings": {
"appearanceTools": true,
"color": {
"defaultPalette": false,
"palette": [
{
"slug": "night",
"color": "#0D1117",
"name": "Night"
},
{
"slug": "panel",
"color": "#161B22",
"name": "Panel"
},
{
"slug": "violet",
"color": "#7C6CF0",
"name": "Violet"
},
{
"slug": "green",
"color": "#5FB88A",
"name": "Green"
},
{
"slug": "foreground",
"color": "#E6EDF3",
"name": "Text"
},
{
"slug": "muted",
"color": "#8B949E",
"name": "Muted"
},
{
"slug": "paper",
"color": "#F6F2E9",
"name": "Paper"
},
{
"slug": "surface",
"color": "#FFFDF7",
"name": "Surface"
},
{
"slug": "ink",
"color": "#25221F",
"name": "Ink"
},
{
"slug": "light-muted",
"color": "#625C54",
"name": "Light Muted"
},
{
"slug": "light-violet",
"color": "#674CA4",
"name": "Light Violet"
},
{
"slug": "light-green",
"color": "#327854",
"name": "Light Green"
},
{
"slug": "border",
"color": "#DED6C7",
"name": "Border"
}
]
},
"layout": {
"contentSize": "720px",
"wideSize": "1120px"
},
"spacing": {
"defaultSpacingSizes": false,
"spacingSizes": [
{
"slug": "20",
"size": "clamp(0.5rem, 0.4rem + 0.4vw, 0.75rem)",
"name": "2XS"
},
{
"slug": "30",
"size": "clamp(0.75rem, 0.6rem + 0.6vw, 1rem)",
"name": "XS"
},
{
"slug": "40",
"size": "clamp(1rem, 0.8rem + 0.8vw, 1.5rem)",
"name": "Small"
},
{
"slug": "50",
"size": "clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem)",
"name": "Medium"
},
{
"slug": "60",
"size": "clamp(2.25rem, 1.6rem + 2vw, 3.5rem)",
"name": "Large"
},
{
"slug": "70",
"size": "clamp(3rem, 2rem + 3vw, 5rem)",
"name": "XL"
}
],
"units": [
"px",
"rem",
"em",
"%",
"vw",
"vh"
]
},
"typography": {
"defaultFontSizes": false,
"fluid": true,
"fontFamilies": [
{
"slug": "body",
"name": "System UI",
"fontFamily": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif"
},
{
"slug": "heading",
"name": "Zen Maru Gothic",
"fontFamily": "\"Zen Maru Gothic\", sans-serif",
"fontFace": [
{
"fontFamily": "Zen Maru Gothic",
"fontStyle": "normal",
"fontWeight": "500",
"fontDisplay": "swap",
"src": [
"file:./assets/fonts/zen-maru-gothic-latin-500.woff2"
]
},
{
"fontFamily": "Zen Maru Gothic",
"fontStyle": "normal",
"fontWeight": "700",
"fontDisplay": "swap",
"src": [
"file:./assets/fonts/zen-maru-gothic-latin-700.woff2"
]
}
]
},
{
"slug": "metadata",
"name": "System Monospace",
"fontFamily": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
}
],
"fontSizes": [
{
"slug": "small",
"size": "clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem)",
"name": "Small"
},
{
"slug": "medium",
"size": "clamp(1rem, 0.95rem + 0.2vw, 1.125rem)",
"name": "Medium"
},
{
"slug": "large",
"size": "clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem)",
"name": "Large"
},
{
"slug": "x-large",
"size": "clamp(1.75rem, 1.35rem + 1.6vw, 2.75rem)",
"name": "Extra Large"
},
{
"slug": "display",
"size": "clamp(2.5rem, 1.7rem + 3.2vw, 4.75rem)",
"name": "Display"
}
]
}
},
"styles": {
"color": {
"background": "var:preset|color|night",
"text": "var:preset|color|foreground"
},
"spacing": {
"blockGap": "var:preset|spacing|50"
},
"typography": {
"fontFamily": "var:preset|font-family|body",
"fontSize": "var:preset|font-size|medium",
"lineHeight": "1.65"
},
"elements": {
"button": {
"color": {
"background": "var:preset|color|green",
"text": "var:preset|color|night"
},
"typography": {
"fontWeight": "700"
}
},
"heading": {
"color": {
"text": "var:preset|color|foreground"
},
"typography": {
"fontFamily": "var:preset|font-family|heading",
"fontWeight": "700",
"lineHeight": "1.2"
}
},
"link": {
"color": {
"text": "var:preset|color|violet"
},
"typography": {
"textDecoration": "underline"
}
}
},
"blocks": {
"core/button": {
"border": {
"radius": "0.35rem"
}
},
"core/post-date": {
"color": {
"text": "var:preset|color|muted"
},
"typography": {
"fontFamily": "var:preset|font-family|metadata",
"fontSize": "var:preset|font-size|small"
}
},
"core/post-terms": {
"color": {
"text": "var:preset|color|muted"
},
"typography": {
"fontFamily": "var:preset|font-family|metadata",
"fontSize": "var:preset|font-size|small"
}
},
"core/quote": {
"border": {
"color": "var:preset|color|violet",
"style": "solid",
"width": "0 0 0 3px"
}
}
}
}
}