From 9286468ce9e94816f12fe073946184357dff4e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Thu, 29 Oct 2026 13:30:10 +0100 Subject: [PATCH] Design tokens proposal: inverse surface scope Co-Authored-By: Claude Opus 5.5 --- docs/dev/design-tokens-proposal.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/dev/design-tokens-proposal.md b/docs/dev/design-tokens-proposal.md index 0042b36..539ec5e 100644 --- a/docs/dev/design-tokens-proposal.md +++ b/docs/dev/design-tokens-proposal.md @@ -208,7 +208,19 @@ Unset hover/state tints are derived in CSS with `color-mix(in oklch, …)`: - Block library, starter primitives (`Button`, `Section`, `SectionHeader`, `Card`) and plugin components use only the utilities/vars in section 3. - `Section` maps `settings.background`: `default → bg-bg text-fg`, `muted → bg-surface-muted`, - `inverted → bg-inverse text-on-inverse` (and a scoped override so nested text tokens read inverse). + `inverted → bg-inverse` + `data-surface="inverse"` (agreed with the block library). +- **Inverse scope** (`tailwind.css` / `tokens.css`): `[data-surface=inverse]` re-maps the roles that nested content + reads, so cards, rich text, links and focus rings need no inverse variants: + `--ipal-text` and `--ipal-text-strong` → `--ipal-text-inverse`; + `--ipal-text-muted` → `color-mix(in oklch, var(--ipal-text-inverse) 72%, var(--ipal-surface-inverse))`; + `--ipal-border` / `-strong` → the same mix at 18% / 30%; + `--ipal-surface` and `--ipal-hover` → the mix at 8% / 12% (a card inside stays a step off the background); + `--ipal-link` → **`--ipal-link-inverse`**; `--ipal-focus` → **`--ipal-focus-inverse`**. + Both new tokens default to `--ipal-text-inverse`, and a brand may set them. It also sets `color-scheme` to the + opposite of the theme, so form controls match. `primary` / `accent` are not re-mapped: the `ipal-tokens` + contrast report checks `primary` on `surface-inverse` and warns. `data-surface="muted"` exists as a hook, + but re-maps nothing by default. The contrast report checks every text role on `surface-muted` too, so a + failing brand is caught there instead. - `Button` variants map to `primary` / `secondary` / ghost (`hover`) / link, `rounded-control`, `duration-fast ease-out`. - Brand-specific looks that tokens can't express use a **variant** (§6.0 rule 5), never a fork.