chore: update css rules, add hct plugin

This commit is contained in:
2026-09-02 09:51:14 +05:00
parent 1310c51543
commit 98a4bacd23
13 changed files with 690 additions and 152 deletions
+27
View File
@@ -0,0 +1,27 @@
// Theme parity: every color token in `:root` must also exist in
// `[data-theme="dark"]` and vice versa. A color defined in only one theme
// silently breaks dark mode. Derived tokens (values containing var()) adapt
// to the theme automatically and are exempt.
import { isColorValue, isDerived } from "./helpers.mjs";
export function checkParity({ light, dark }) {
const errors = [];
// Every colorful light token must have a dark-mate (derived excluded).
for (const [token, value] of light) {
if (!isColorValue(value) || isDerived(value)) continue;
if (!dark.has(token)) {
errors.push(` ${token} in :root has no [data-theme="dark"] override`);
}
}
// Every dark token must exist in :root (a dark-only token is orphaned).
for (const [token] of dark) {
if (!light.has(token)) {
errors.push(` ${token} in [data-theme="dark"] is missing in :root`);
}
}
return errors;
}