Design tokens proposal: inverse surface scope
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
655b12a232
commit
9286468ce9
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user