Interface Optional
Define every colour once
Define every colour once as a light-dark() custom property, and switch themes with color-scheme, never with duplicate rules.
How to do it
Put tokens such as --paper: light-dark(#fff, #14172e) on :root. A theme switch sets data-theme, which sets color-scheme. The colour scheme rule covers the meta tag and the first paint.
Example
:root {
color-scheme: light dark;
--paper: light-dark(#fff, #14172e);
--ink: light-dark(#1b1f3b, #e8eaf6);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body { background: var(--paper); color: var(--ink); }
How to check
Search the stylesheet. No colour values appear outside :root, apart from black stops in masks, which set transparency rather than colour.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/interface/colour-as-tokens.