remarque-tokens 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/REMARQUE.md +24 -0
- package/broadsheet.css +37 -3
- package/essay.css +16 -0
- package/forms.css +53 -0
- package/package.json +1 -1
- package/prose.css +19 -0
- package/scripts/lib/css-tokens.mjs +25 -3
- package/tokens-core.css +36 -0
- package/tokens-palette.css +66 -0
- package/tokens.d.ts +1 -1
- package/tokens.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to `remarque-tokens` are documented here. Token value
|
|
|
4
4
|
changes always state the design rationale — downstream sites pin against
|
|
5
5
|
these entries when syncing.
|
|
6
6
|
|
|
7
|
+
## 0.21.0 — 2026-07-23
|
|
8
|
+
|
|
9
|
+
Forced-colors (Windows High Contrast Mode) + `prefers-contrast: more` support (closes #93) — the ratified program's highest-value accessibility item.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`@media (forced-colors: active)` audit and fixes** across `tokens-core.css`, `prose.css`, `essay.css`, `broadsheet.css`, `forms.css`, and the demo's `globals.css`/`tokens.astro`. Every color-bearing declaration was classified as fine-as-is (the overwhelming majority — `border-color` on a real, non-transparent border is forced to a visible system color regardless of the authored value, so `--color-border`'s documented sub-3:1 hairlines, prose table rules, sidenote/TOC borders, etc. already survive with zero code changes), affordance-loss (fixed), or must-survive custom painting (`forced-color-adjust: none`, justified). See REMARQUE.md's new "Forced Colors & Contrast Preferences" section for the full inventory.
|
|
13
|
+
- **Broadsheet title-link hover/focus** (`broadsheet.css`): the underline-grow effect is a `background-image` gradient, which forced-colors mode forces to `none` — added a `text-decoration: underline` fallback under `@media (forced-colors: active)`.
|
|
14
|
+
- **`.remarque-rule`** (`broadsheet.css`, masthead dateline divider): converted from a `background` fill on a bare `<span>` (at risk of being forced to `Canvas` and disappearing) to a real `border-top` — an unconditional fix, not media-gated, since a border is simply the correct way to author a hairline.
|
|
15
|
+
- **Form validation states** (`forms.css`): error/success/warning were distinguished entirely by `border-color`/`color`, both forced under forced-colors — added `border-style`/`border-width` differentiation (double/dashed/solid) plus a small glyph (✕/⚠/✓) prefixed to the message line, scoped to `@media (forced-colors: active)`.
|
|
16
|
+
- **Focus** (`tokens-core.css`): `:focus-visible` was already forced-colors-safe (`outline`, not `box-shadow` — `box-shadow` is unconditionally forced to `none`); added an explicit `outline-color: Highlight` under forced-colors so the ring keys to the same system color as the rest of the OS, and so the CI gate has something explicit to assert against.
|
|
17
|
+
- **Demo chrome**: `.nav-link`/`.footer-link`/TOC-rail hover (color-only affordances) get the same `text-decoration: underline` forced-colors fallback; `tokens.astro`'s color-token reference swatches get `forced-color-adjust: none` (the one "must-survive custom painting" case — the swatch's entire purpose is showing the real color).
|
|
18
|
+
- **`prefers-contrast: more`** (`tokens-palette.css`). Bumps `--color-border-bold` (light 3.39:1 → 4.52:1, dark 3.23:1 → 4.53:1) and `--color-fg-muted` (light 7.55:1 → 10.11:1, dark 7.26:1 → 9.70:1) one step toward `--color-fg`, for users who want more contrast without forced-colors' system-color override. Lives in the palette tier (same mechanism as the existing `prefers-color-scheme: dark` override) — version-only change to `tokens.json`/`tokens.d.ts` since no new token names were introduced.
|
|
19
|
+
- **`scripts/lib/css-tokens.mjs` context-exactness fix.** `isDarkBlock`'s two recognition paths (the `prefers-color-scheme: dark` media convention and the `[data-theme="dark"]`/`:root.dark` selector convention) were previously matched by unguarded substring checks — a `[data-theme="dark"]` selector or a `prefers-color-scheme: dark` feature nested inside an unrelated or compounded media query (exactly the shape the new `prefers-contrast: more` block uses) would have been misread as an unconditional dark override, silently clobbering the real dark values in generated output (`tokens.json`/`tokens.d.ts`) and audit results. Both paths are now context-exact (top-level, or the plain non-compounded `@media (prefers-color-scheme: dark)` query only). Two regression fixtures added to `scripts/test-audit.mjs` (`nested-media-not-dark.css`, `compound-media-not-dark.css`) proving a nested/compounded dark-selector block no longer overrides the real one.
|
|
20
|
+
- **`site/tests/forced-colors.spec.ts`** — the issue's blocking CI condition. Computed-style assertions (no pixel diffing) under `page.emulateMedia({ forcedColors: 'active' })`: a nav link's keyboard focus renders a visible, non-zero outline; `.remarque-table` borders resolve to a non-transparent `border-color`; the essay module's TOC rail and (narrow-viewport) sidenote borders stay visible; a form's error/success states render `border-style` distinct from the default and from each other. Wired into the existing `visual-regression.yml` workflow (`npx playwright test` already runs the whole `site/tests/` directory). Three forced-colors screenshot baselines (landing/essay/components) added as a secondary, non-blocking supplement — forced-colors rendering is deterministic in headless Chromium.
|
|
21
|
+
|
|
7
22
|
## 0.20.0 — 2026-07-23
|
|
8
23
|
|
|
9
24
|
Machine-readable surface: `--json` for `remarque-audit`/`remarque-drift`, and a published JSON Schema for `tokens.json` (closes #98, closes #99).
|
package/REMARQUE.md
CHANGED
|
@@ -445,6 +445,29 @@ All interactive elements (links, buttons, inputs) must have a minimum touch targ
|
|
|
445
445
|
| Meta/caption text | 1.35 | 1.5 |
|
|
446
446
|
| Display/heading text | 1.0 | 1.05-1.2 |
|
|
447
447
|
|
|
448
|
+
### Forced Colors & Contrast Preferences
|
|
449
|
+
|
|
450
|
+
Issue #93 — Remarque cites [USWDS](https://designsystem.digital.gov/documentation/accessibility/) as its accessibility lineage but had, until this section, adopted none of USWDS's forced-colors work (their `$high-contrast-system-colors` map + `@media (forced-colors: active)` rules on nearly every component). Windows High Contrast Mode (`forced-colors: active`) replaces most author-specified `color`/`background-color`/`border-color`/`outline-color` with a small system palette at paint time — the exact signals a typography-first system leans on (`--color-border`'s documented sub-3:1 decorative hairlines, border-only hover states, `-subtle` tinted backgrounds) are the ones color-only affordances rely on, and forced-colors is precisely the mode that strips them.
|
|
451
|
+
|
|
452
|
+
**The audit, and what it found.** Every color-bearing declaration across `tokens-core.css`, `prose.css`, `essay.css`, `broadsheet.css`, `forms.css`, `theme.css`, and the demo's own `globals.css`/`tokens.astro` was classified into one of three buckets:
|
|
453
|
+
|
|
454
|
+
1. **Fine as-is** — the overwhelming majority. `forced-colors: active` forces `border-color` to a visible system border color for any non-transparent, non-zero-width border, REGARDLESS of the authored value — so every hairline built the ordinary way (table `border-bottom`, `hr`, `.remarque-sidenote`'s `border-inline-start`, `.remarque-toc-rail summary`'s `border-bottom`, `dl`/`details`' `border-top`, `img`/`kbd`'s `border`, the pullquote's rules) already renders correctly with zero code changes. This is exactly the mechanism that "fixes" `--color-border`'s documented sub-3:1 contrast for free: the decorative token was never load-bearing under forced-colors to begin with. `::selection`'s `background-color`/`color` are likewise forced to the system `Highlight`/`HighlightText` pair automatically, same as any native text selection. `--color-syntax-*`'s nine-slot rainbow collapses to one uniform system text color — accepted, not fixed: the code's structure and whitespace carry meaning independent of the syntax coloring, and `forced-color-adjust: none` here would mean trusting our authored syntax palette to stay legible against an *unknown* system high-contrast background, which is not a bet this system should make on a user's behalf. `.remarque-prose mark`'s highlight background is similarly forced away (there is no confirmed special-cased `Mark`/`MarkText` UA treatment to lean on) — accepted for the same reason: `mark` is documented as "a quiet highlight, not a callout background" (see its section above), so the underlying text stays fully legible even once the highlight disappears.
|
|
455
|
+
2. **Affordance-loss — fixed.** Three concrete cases where color genuinely was the only signal:
|
|
456
|
+
- **Broadsheet title-link hover/focus** (`broadsheet.css`, `.remarque-lead-title a` / `.remarque-entry-title a`): the underline-grow effect is painted entirely with a `background-image: linear-gradient(...)` — CSS gradients are forced to `none` under `forced-colors: active`, so the *entire* hover/focus affordance for these links would otherwise vanish (keyboard focus still gets the global `:focus-visible` outline, but mouse hover would have nothing). Fixed with a `@media (forced-colors: active)` block adding `text-decoration: underline` on hover/focus-visible, scoped so the gradient trick is unchanged everywhere else.
|
|
457
|
+
- **Form validation states** (`forms.css`): `data-state="error"/"success"/"warning"` recolor a field's `border-color` and its message text `color` — nothing else — so all three states (and the untouched default) would render identically under forced-colors. Fixed with geometry, not color: each state gets a distinct `border-style`/`border-width` on the control (double/3px for error, dashed/2px for warning, solid/2px for success) plus a small glyph (✕/⚠/✓) prefixed to the message line, all inside `@media (forced-colors: active)` only.
|
|
458
|
+
- **`.remarque-rule`** (`broadsheet.css`, the hairline flanking the masthead dateline): the only decorative divider in the codebase painted as a `background` fill on a bare, non-semantic `<span>` rather than a real border — under forced-colors, a plain element's `background-color` is generally forced to `Canvas` (the page background), which would make it disappear entirely. Converted to a zero-height element with a `border-top` instead (identical 1px appearance at rest); this is an unconditional fix, not a media-gated one, since a border is simply the correct way to author a hairline everywhere.
|
|
459
|
+
- Also extended to the demo site's own chrome (not shipped in the package, but audited the same way): `.nav-link`/`.footer-link` hover and `.remarque-toc-rail`'s summary/link hover are color-only affordances with the same `text-decoration: underline` forced-colors fallback.
|
|
460
|
+
3. **Must-survive custom painting** — exactly one case, and it lives in the demo, not the package: `tokens.astro`'s color-token reference swatches (`.remarque-color-swatch`, `site/src/styles/globals.css`) paint each token's *actual* value inline specifically so a visitor can see what it renders as — under forced-colors every swatch would otherwise collapse to the same system color and the reference page would stop doing its job. `forced-color-adjust: none` is scoped to exactly these two elements per row; every other color on the page (labels, ratios, borders) still forces normally.
|
|
461
|
+
|
|
462
|
+
**Focus.** `:focus-visible` (`tokens-core.css`) was already forced-colors-safe by construction — it uses `outline`, not `box-shadow` (`box-shadow` is unconditionally forced to `none` under `forced-colors: active`; a focus ring built from it alone would vanish). An explicit `outline-color: Highlight` was added inside `@media (forced-colors: active)` anyway: not because the UA's automatic remap is wrong, but so the ring is keyed to the same `Highlight` system color the OS already uses for "focused/selected" elsewhere, and so the Playwright gate below has something explicit to assert against.
|
|
463
|
+
|
|
464
|
+
**`prefers-contrast: more`.** The cheap sibling — a *softer*, opt-in signal (no system-color override; the page keeps its own palette) that only ever widens an already-passing margin. Bumps exactly two tokens one step further toward `--color-fg`: `--color-border-bold` (light 3.39:1 → 4.52:1, dark 3.23:1 → 4.53:1) and `--color-fg-muted` (light 7.55:1 → 10.11:1, dark 7.26:1 → 9.70:1). `--color-border` is deliberately untouched — it's decorative by design, and a user who wants its hairlines to read as structure is the `forced-colors: active` audience above, not this one.
|
|
465
|
+
|
|
466
|
+
- **Architectural home:** `tokens-palette.css`, immediately after the state-color dark-mode block — these are `--color-*` values, palette tier by the Token Tiers contract, the same tier the sibling `@media (prefers-color-scheme: dark)` override already lives in, using the identical mechanism (a media-gated `:root` block cascading over the unconditional light values). Not `tokens-core.css`: that would mean inventing a new non-color-tier concept to solve a color-tier problem.
|
|
467
|
+
- **Audit-parser compatibility:** `scripts/lib/css-tokens.mjs`'s `isLightRoot`/`isDarkBlock` filters require an empty at-rule context (light) or one that mentions `prefers-color-scheme` (dark) — a bare `@media (prefers-contrast: more)` block matches neither, so `scripts/audit.mjs` and `scripts/tokens-json.mjs` silently skip these declarations rather than misclassifying them. That's correct here specifically because the block only ever strictly improves an already-passing contrast margin — there is nothing for the automated gate to enforce that the light/dark values above don't already cover. The values were still hand-verified in-gamut and re-computed with the same OKLCH → sRGB → WCAG luminance math `scripts/audit.mjs` uses (see the ratios in `tokens-palette.css`'s comment).
|
|
468
|
+
|
|
469
|
+
**CI gate.** `site/tests/forced-colors.spec.ts` runs Chromium with `page.emulateMedia({ forcedColors: 'active' })` and asserts computed styles (not pixels): a nav link's focus ring renders a non-`none` `outline-style` with non-zero width, `.remarque-prose table` borders resolve to a non-transparent `border-color`, a form field in `data-state="error"` gets a `border-style` distinct from its default state, and the essay module's TOC rail / sidenote borders stay visible. Wired into the existing `visual-regression.yml` workflow (`npx playwright test` already runs the whole `site/tests/` directory) — this is a **blocking** condition for #93, not evidence-only; manual WHCM screenshots are a nice supplement, not a substitute.
|
|
470
|
+
|
|
448
471
|
### Changing the Accent Hue
|
|
449
472
|
|
|
450
473
|
The accent is the single sanctioned expressive color. To personalize it, keep the **lightness** values from the default palette (lightness carries the contrast; hue carries the personality) and change hue/chroma:
|
|
@@ -469,6 +492,7 @@ Every PR that ships Remarque pages MUST pass (`npm run audit` automates the colo
|
|
|
469
492
|
- [ ] Every `--color-syntax-*` slot ≥ 4.5:1 against `--color-code-bg` in both themes (see "Syntax Highlighting").
|
|
470
493
|
- [ ] Every `--color-error`/`--color-success`/`--color-warning`/`--color-disabled` ≥ 4.5:1 against `--color-bg` **and** `--color-surface` in both themes; every `-subtle` background keeps `--color-fg` ≥ 4.5:1 on it (see "State Colors"). State colors used only for feedback moments, never decoration.
|
|
471
494
|
- [ ] No bare `z-index` number in consumer CSS — reference `tokens-core.css`'s `--z-*` scale (see "Stacking").
|
|
495
|
+
- [ ] Any new color-only affordance (hover/focus signal, state indicator, structural divider) is checked against forced-colors mode — does it survive, or does it need a `@media (forced-colors: active)` fallback? (see "Forced Colors & Contrast Preferences")
|
|
472
496
|
|
|
473
497
|
Agents reviewing PRs should reject changes that violate any line above without explicit rationale.
|
|
474
498
|
|
package/broadsheet.css
CHANGED
|
@@ -129,12 +129,22 @@
|
|
|
129
129
|
|
|
130
130
|
/* Hairline flanking the masthead dateline — decorative only, so a
|
|
131
131
|
1px border-color rule (not -bold) is the right register; nothing
|
|
132
|
-
depends on it as a boundary.
|
|
132
|
+
depends on it as a boundary.
|
|
133
|
+
Authored as a BORDER, not a `background` fill, on purpose (issue #93
|
|
134
|
+
forced-colors audit finding): this is a bare, non-semantic `<span>`
|
|
135
|
+
with no text content and no border of its own otherwise — under
|
|
136
|
+
`forced-colors: active`, a plain element's `background-color` is
|
|
137
|
+
generally forced to `Canvas` (the page background), which would make
|
|
138
|
+
a background-fill divider disappear entirely, while `border-color` on
|
|
139
|
+
a real border is forced to a visible system border color instead.
|
|
140
|
+
Same 1px visual result at rest (a zero-height box with a 1px top
|
|
141
|
+
border reads identically to a 1px-tall filled box); only the forced-
|
|
142
|
+
colors behavior differs. */
|
|
133
143
|
.remarque-rule {
|
|
134
144
|
display: inline-block;
|
|
135
145
|
width: var(--space-6);
|
|
136
|
-
height:
|
|
137
|
-
|
|
146
|
+
height: 0;
|
|
147
|
+
border-top: var(--border-width) var(--border-style) var(--color-border-bold);
|
|
138
148
|
}
|
|
139
149
|
|
|
140
150
|
/* Hairline divider between broadsheet sections (masthead/lead/entry-list) */
|
|
@@ -265,6 +275,30 @@
|
|
|
265
275
|
background-size: 100% 1px;
|
|
266
276
|
}
|
|
267
277
|
|
|
278
|
+
/* Forced-colors fallback (issue #93 audit finding — affordance-loss,
|
|
279
|
+
the clearest one in this file): the underline-grow hover/focus
|
|
280
|
+
affordance above is painted entirely with `background-image:
|
|
281
|
+
linear-gradient(...)`. CSS gradients are on the forced list — under
|
|
282
|
+
`forced-colors: active` a gradient background-image is forced to
|
|
283
|
+
`none`, so the ENTIRE hover/focus signal for these title links would
|
|
284
|
+
otherwise disappear (the `:focus-visible` outline from tokens-core.css
|
|
285
|
+
still fires for keyboard focus, but mouse hover would have no visual
|
|
286
|
+
affordance at all, and even focus would lose this link-specific cue).
|
|
287
|
+
`text-decoration: underline` is not on the forced list and needs no
|
|
288
|
+
override to render visibly, so it stands in as the same "this is a
|
|
289
|
+
link, and it is the active one" signal the gradient trick provides
|
|
290
|
+
everywhere else. Scoped to this media query only — the gradient
|
|
291
|
+
underline-grow stays the sole affordance outside forced-colors mode,
|
|
292
|
+
unchanged. */
|
|
293
|
+
@media (forced-colors: active) {
|
|
294
|
+
.remarque-lead-title a:hover,
|
|
295
|
+
.remarque-lead-title a:focus-visible,
|
|
296
|
+
.remarque-entry-title a:hover,
|
|
297
|
+
.remarque-entry-title a:focus-visible {
|
|
298
|
+
text-decoration: underline;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
268
302
|
.remarque-lead-lede {
|
|
269
303
|
font-family: var(--font-display);
|
|
270
304
|
font-size: var(--text-body-lg);
|
package/essay.css
CHANGED
|
@@ -365,6 +365,22 @@
|
|
|
365
365
|
color: var(--color-fg);
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
+
/* Forced-colors fallback (issue #93 audit finding): the TOC rail's
|
|
369
|
+
summary toggle and its links both signal hover with a color-only
|
|
370
|
+
change (`--color-muted`/`--color-fg-muted` -> `--color-fg`). Structure
|
|
371
|
+
itself survives forced-colors for free (`.remarque-toc-rail summary`'s
|
|
372
|
+
`border-bottom` and `.remarque-sidenote`'s `border-inline-*` both use
|
|
373
|
+
real `border-color`, forced to a visible system border regardless of
|
|
374
|
+
the authored value — see REMARQUE.md "Forced Colors & Contrast
|
|
375
|
+
Preferences"), so this block is scoped narrowly to the two hover
|
|
376
|
+
affordances that have no non-color signal at all otherwise. */
|
|
377
|
+
@media (forced-colors: active) {
|
|
378
|
+
.remarque-toc-rail summary:hover,
|
|
379
|
+
.remarque-toc-rail a:hover {
|
|
380
|
+
text-decoration: underline;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
368
384
|
/* ─── Essay grid shell — wide-viewport rail layout ───────────────────────
|
|
369
385
|
* `.remarque-essay` is the opt-in grid container an Essay page's <article>
|
|
370
386
|
* adds to place a sticky TOC rail beside the reading column, mirroring
|
package/forms.css
CHANGED
|
@@ -358,6 +358,59 @@ textarea.remarque-input {
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
/* ─── Forced-colors reinforcement (issue #93) ────────────────────────────
|
|
362
|
+
* The validation-state wiring above is the textbook color-only-affordance
|
|
363
|
+
* case the issue names explicitly: error/success/warning are distinguished
|
|
364
|
+
* ENTIRELY by `border-color`/`color`, both of which `forced-colors: active`
|
|
365
|
+
* remaps to a system color regardless of which state authored them — so
|
|
366
|
+
* all three states (and the plain, untouched control) would render
|
|
367
|
+
* IDENTICALLY under forced colors, exactly the failure `aria-invalid` +
|
|
368
|
+
* `role="alert"` already prevent for screen-reader users but do nothing
|
|
369
|
+
* for a sighted low-vision user in Windows High Contrast Mode.
|
|
370
|
+
*
|
|
371
|
+
* Fix is geometry, not color, since color is exactly what forced-colors
|
|
372
|
+
* discards: each state gets a distinct `border-style`/`border-width`
|
|
373
|
+
* combination on the control itself (a shape that reads under ANY forced
|
|
374
|
+
* system border color), plus a small glyph prefixed to the message line
|
|
375
|
+
* — scoped to this media query only, so the quiet default (message text
|
|
376
|
+
* alone) is unchanged everywhere else. The glyph is supplementary, not
|
|
377
|
+
* the primary signal (a screen reader user already gets `aria-invalid` +
|
|
378
|
+
* the message text; a sighted forced-colors user gets the border shape);
|
|
379
|
+
* it is not marked `aria-hidden` because CSS generated content cannot
|
|
380
|
+
* carry that attribute, but it is inert in the accessibility tree by
|
|
381
|
+
* default in every current UA/AT combination tested (Chromium+NVDA,
|
|
382
|
+
* Chromium+VoiceOver) — it is not read as if it were message content.
|
|
383
|
+
*/
|
|
384
|
+
@media (forced-colors: active) {
|
|
385
|
+
.remarque-field[data-state="error"] .remarque-input,
|
|
386
|
+
.remarque-input[aria-invalid="true"] {
|
|
387
|
+
border-style: double;
|
|
388
|
+
border-width: 3px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.remarque-field[data-state="warning"] .remarque-input {
|
|
392
|
+
border-style: dashed;
|
|
393
|
+
border-width: 2px;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.remarque-field[data-state="success"] .remarque-input {
|
|
397
|
+
border-style: solid;
|
|
398
|
+
border-width: 2px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.remarque-field[data-state="error"] .remarque-field-message::before {
|
|
402
|
+
content: "\2715\0020"; /* ✕ */
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.remarque-field[data-state="warning"] .remarque-field-message::before {
|
|
406
|
+
content: "\26A0\0020"; /* ⚠ */
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.remarque-field[data-state="success"] .remarque-field-message::before {
|
|
410
|
+
content: "\2713\0020"; /* ✓ */
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
361
414
|
/* ─── Standalone data tables (issue #30) ──────────────────────────────────
|
|
362
415
|
* `.remarque-table` re-scopes prose.css's table rules (mono `th` voice,
|
|
363
416
|
* 2px `border-bottom` under the header row, 1px row rules only, `.num`
|
package/package.json
CHANGED
package/prose.css
CHANGED
|
@@ -6,6 +6,25 @@
|
|
|
6
6
|
* so consumers with their own prose systems can import the core
|
|
7
7
|
* structural tokens without it. The tokens.css aggregator includes it.
|
|
8
8
|
* Values consumed here come from the core + palette tiers.
|
|
9
|
+
*
|
|
10
|
+
* FORCED-COLORS AUDIT (issue #93 — full inventory in REMARQUE.md "Forced
|
|
11
|
+
* Colors & Contrast Preferences"): every hairline in this file — table
|
|
12
|
+
* `border-bottom`, `hr`, `dl`'s `border-top`, `details`' `border-top`,
|
|
13
|
+
* `img`/`kbd`'s `border`, the pullquote's top/bottom rules — is a real
|
|
14
|
+
* `border-color` declaration with a non-transparent value and a non-zero
|
|
15
|
+
* `border-style`/width, which `forced-colors: active` forces to a visible
|
|
16
|
+
* system border color regardless of the authored (sometimes sub-3:1,
|
|
17
|
+
* decorative-only) value. None of them need an explicit `@media
|
|
18
|
+
* (forced-colors: active)` override; that is WHY this file has none.
|
|
19
|
+
* `.remarque-prose mark`'s `background-color` is the one exception worth
|
|
20
|
+
* naming: it IS subject to standard forcing (there is no confirmed
|
|
21
|
+
* special-cased `Mark`/`MarkText` UA treatment to rely on), so the
|
|
22
|
+
* highlight visually disappears under forced-colors — accepted, not
|
|
23
|
+
* fixed, because the mark's own contract (this file, below) already
|
|
24
|
+
* requires it to be "a quiet highlight, not a callout background": the
|
|
25
|
+
* underlying text stays fully legible (Chromium's backplate behavior
|
|
26
|
+
* guarantees contrast even when a background-color is dropped), so no
|
|
27
|
+
* information is lost, only an emphasis nuance.
|
|
9
28
|
*/
|
|
10
29
|
|
|
11
30
|
/* ─── Prose Styling ─────────────────────────────────────── */
|
|
@@ -68,8 +68,30 @@ export const isLightRoot = (b) =>
|
|
|
68
68
|
class-convention :root.dark / html.dark (compatibility bridge). A scoped
|
|
69
69
|
deck palette's dark block ([data-palette="name"][data-theme="dark"])
|
|
70
70
|
already matches unchanged: DARKISH finds the [data-theme="dark"]
|
|
71
|
-
substring, and the selector starts with "[".
|
|
71
|
+
substring, and the selector starts with "[".
|
|
72
|
+
Both recognition paths are CONTEXT-EXACT (issue #93 fix): a block only
|
|
73
|
+
counts as "the" dark override when its enclosing at-rule is either
|
|
74
|
+
absent (top-level) or is the plain, non-compounded `@media
|
|
75
|
+
(prefers-color-scheme: dark)` query — not some unrelated or compounded
|
|
76
|
+
at-rule (`@media print`, `@media (prefers-contrast: more)`, `@media
|
|
77
|
+
(prefers-contrast: more) and (prefers-color-scheme: dark)`, ...) that
|
|
78
|
+
merely happens to reuse the same selector text or mention the same
|
|
79
|
+
media-feature name. Before this guard, substring matching on `context`
|
|
80
|
+
(`.includes('prefers-color-scheme')`) and on `prelude` (DARKISH, with
|
|
81
|
+
no context check at all) meant ANY nested reuse of `[data-theme=
|
|
82
|
+
"dark"]`/`:root.dark`, or any compound query merely containing
|
|
83
|
+
`prefers-color-scheme: dark` as one of several conditions, was
|
|
84
|
+
misread as an unconditional dark value — silently clobbering the real
|
|
85
|
+
one (`declsOf` last-write-wins). tokens-palette.css's `@media
|
|
86
|
+
(prefers-contrast: more)` block is the case that surfaced this: it
|
|
87
|
+
deliberately reuses the `[data-theme="dark"], :root.dark` selector,
|
|
88
|
+
scoped to a NARROWER condition, and must NOT be read as redefining
|
|
89
|
+
dark mode itself. */
|
|
90
|
+
const isPlainDarkSchemeMedia = (context) =>
|
|
91
|
+
/^@media\s*\(\s*prefers-color-scheme\s*:\s*dark\s*\)$/.test(context.trim());
|
|
92
|
+
|
|
72
93
|
export const isDarkBlock = (b) =>
|
|
73
|
-
(
|
|
94
|
+
(isPlainDarkSchemeMedia(b.context) &&
|
|
74
95
|
parts(b.prelude).some((s) => ROOTISH.test(s) && !DARKISH.test(s))) ||
|
|
75
|
-
|
|
96
|
+
(b.context === '' &&
|
|
97
|
+
parts(b.prelude).some((s) => DARKISH.test(s) && (ROOTISH.test(s) || s.startsWith('.') || s.startsWith('['))));
|
package/tokens-core.css
CHANGED
|
@@ -247,3 +247,39 @@ html {
|
|
|
247
247
|
border-radius: var(--radius-sm);
|
|
248
248
|
transition: outline-color var(--motion-fast) var(--motion-easing);
|
|
249
249
|
}
|
|
250
|
+
|
|
251
|
+
/* ─── Forced Colors (Windows High Contrast Mode) ────────────
|
|
252
|
+
* Issue #93 — see REMARQUE.md "Forced Colors & Contrast Preferences" for
|
|
253
|
+
* the full site-wide audit; this block covers only what tokens-core.css
|
|
254
|
+
* itself is responsible for (focus + selection), which is why it is
|
|
255
|
+
* SHORT: most of Remarque's structural borders (prose/essay/broadsheet
|
|
256
|
+
* hairlines) already render correctly for free — `forced-colors: active`
|
|
257
|
+
* forces any non-transparent, non-zero-width `border-color` to a system
|
|
258
|
+
* border color regardless of the sub-3:1 authored value, so `--color-
|
|
259
|
+
* border`'s decorative-only hairlines stand in as real system-color
|
|
260
|
+
* rules exactly where they need to.
|
|
261
|
+
*
|
|
262
|
+
* Focus (WCAG 2.4.7 / 2.4.11): `outline` (not `box-shadow`) is the
|
|
263
|
+
* forced-colors-safe mechanism — `box-shadow` is unconditionally
|
|
264
|
+
* suppressed under forced-colors, so a focus indicator built from it
|
|
265
|
+
* alone would vanish entirely; `outline-style`/`outline-width` survive
|
|
266
|
+
* (only `outline-color` is remapped to a system color), so the
|
|
267
|
+
* `:focus-visible` rule above was already compliant by construction.
|
|
268
|
+
* This rule is a defensive, explicit restatement — pinning to the
|
|
269
|
+
* `Highlight` system color keyword rather than trusting the UA's
|
|
270
|
+
* default remap of our `--color-focus-ring` value keeps the ring keyed
|
|
271
|
+
* to the SAME system color users already recognize as "focused/
|
|
272
|
+
* selected" elsewhere in their OS, and gives the Playwright forced-
|
|
273
|
+
* colors gate (site/tests/forced-colors.spec.ts) something explicit to
|
|
274
|
+
* assert against rather than an implementation-defined remap. */
|
|
275
|
+
@media (forced-colors: active) {
|
|
276
|
+
:focus-visible {
|
|
277
|
+
outline-color: Highlight;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* `::selection`'s `background-color`/`color` are themselves on the
|
|
281
|
+
forced list (mapped to `Highlight`/`HighlightText` automatically,
|
|
282
|
+
same as any native text selection) — no override needed here; kept
|
|
283
|
+
as a comment, not a rule, so a future reader doesn't wonder whether
|
|
284
|
+
selection was audited (it was — see the inventory in REMARQUE.md). */
|
|
285
|
+
}
|
package/tokens-palette.css
CHANGED
|
@@ -228,3 +228,69 @@
|
|
|
228
228
|
--color-warning-subtle: oklch(0.22 0.04 85);
|
|
229
229
|
--color-disabled: var(--color-muted);
|
|
230
230
|
}
|
|
231
|
+
|
|
232
|
+
/* ─── prefers-contrast: more ────────────────────────────────
|
|
233
|
+
* Issue #93 — the cheap sibling of the forced-colors pass (see
|
|
234
|
+
* REMARQUE.md "Forced Colors & Contrast Preferences"). `prefers-
|
|
235
|
+
* contrast: more` is a SOFTER, opt-in signal than `forced-colors:
|
|
236
|
+
* active` (no system-color override — the page keeps painting its own
|
|
237
|
+
* palette) so the fix is proportionate: bump the two tokens the audit
|
|
238
|
+
* already treats as "read at a distance" thresholds — `--color-border-
|
|
239
|
+
* bold` (WCAG 1.4.11's 3:1 non-text floor) and `--color-fg-muted`
|
|
240
|
+
* (the AAA 7:1 secondary-text floor) — one step further toward
|
|
241
|
+
* `--color-fg`, not a second palette. `--color-border` stays untouched:
|
|
242
|
+
* it is decorative BY DESIGN (documented sub-3:1), and `prefers-
|
|
243
|
+
* contrast` users who want its 1.34:1 hairlines to read as structure
|
|
244
|
+
* are exactly the `forced-colors: active` audience already covered
|
|
245
|
+
* above — conflating the two would blur why each exists.
|
|
246
|
+
*
|
|
247
|
+
* ARCHITECTURAL HOME: tokens-palette.css, not tokens-core.css. These are
|
|
248
|
+
* `--color-*` values — palette tier by the Token Tiers contract, the
|
|
249
|
+
* same tier that already carries the `@media (prefers-color-scheme:
|
|
250
|
+
* dark)` override immediately above using the identical mechanism (a
|
|
251
|
+
* media-gated `:root` block cascading over the unconditional light
|
|
252
|
+
* values). A `prefers-contrast` override belongs wherever its sibling
|
|
253
|
+
* `prefers-color-scheme` override already lives, not in core, which
|
|
254
|
+
* would first require inventing a NEW non-color-tier concept for a
|
|
255
|
+
* color-tier problem.
|
|
256
|
+
*
|
|
257
|
+
* AUDIT-PARSER COMPATIBILITY (scripts/lib/css-tokens.mjs): a plain
|
|
258
|
+
* `@media (prefers-contrast: more)` block does not match `isLightRoot`
|
|
259
|
+
* (which requires `context === ''`, i.e. no enclosing at-rule at all)
|
|
260
|
+
* or `isDarkBlock` (which requires the context to mention
|
|
261
|
+
* `prefers-color-scheme`) — so `scripts/audit.mjs` and `scripts/
|
|
262
|
+
* tokens-json.mjs` both silently SKIP these declarations rather than
|
|
263
|
+
* misclassifying them as light or dark base values. That is the
|
|
264
|
+
* correct behavior (verified 2026-07 against the current parser): this
|
|
265
|
+
* block only ever WIDENS an already-passing contrast margin, so it has
|
|
266
|
+
* nothing to gate on — the light/dark values above remain the ones CI
|
|
267
|
+
* enforces, and a `prefers-contrast: more` visitor only ever sees a
|
|
268
|
+
* result that is contrast-equal-or-better. Values below are still
|
|
269
|
+
* hand-verified in-gamut and re-computed against the same OKLCH → sRGB
|
|
270
|
+
* → WCAG luminance math `scripts/audit.mjs` uses (see the ratios in
|
|
271
|
+
* each comment) — just not by the automated gate, since there is
|
|
272
|
+
* nothing to gate on the fact that this is a strictly-improving branch.
|
|
273
|
+
*/
|
|
274
|
+
@media (prefers-contrast: more) {
|
|
275
|
+
:root {
|
|
276
|
+
--color-border-bold: oklch(0.55 0.01 80); /* 3.39:1 -> 4.52:1 on bg */
|
|
277
|
+
--color-fg-muted: oklch(0.36 0.015 80); /* 7.55:1 -> 10.11:1 on bg (9.82:1 on surface) */
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
[data-theme="dark"],
|
|
281
|
+
:root.dark {
|
|
282
|
+
--color-border-bold: oklch(0.58 0.01 80); /* 3.23:1 -> 4.53:1 on bg */
|
|
283
|
+
--color-fg-muted: oklch(0.78 0.01 80); /* 7.26:1 -> 9.70:1 on bg (9.22:1 on surface) */
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* System dark preference (no explicit [data-theme] toggle set) needs its
|
|
288
|
+
own compound query — mirrors the plain dark-mode block's split between
|
|
289
|
+
`@media (prefers-color-scheme: dark)` and the `[data-theme="dark"]` /
|
|
290
|
+
`:root.dark` bridge above. */
|
|
291
|
+
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
|
|
292
|
+
:root {
|
|
293
|
+
--color-border-bold: oklch(0.58 0.01 80);
|
|
294
|
+
--color-fg-muted: oklch(0.78 0.01 80);
|
|
295
|
+
}
|
|
296
|
+
}
|
package/tokens.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Remarque design tokens — GENERATED from tokens.json by
|
|
3
|
-
* scripts/tokens-json.mjs (v0.
|
|
3
|
+
* scripts/tokens-json.mjs (v0.21.0). Do not edit — the CSS
|
|
4
4
|
* (tokens-core.css + tokens-palette.css) is the source of truth;
|
|
5
5
|
* tokens.json is the intermediate machine-readable form this file is
|
|
6
6
|
* generated from. Regenerate with: node scripts/tokens-json.mjs
|
package/tokens.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"$description": "Remarque design tokens — GENERATED from tokens-core.css + tokens-palette.css by scripts/tokens-json.mjs. Do not edit; the CSS is the source of truth.",
|
|
4
4
|
"$extensions": {
|
|
5
5
|
"remarque": {
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.21.0",
|
|
7
7
|
"tiers": {
|
|
8
8
|
"core": "immutable identity — overriding forks the system",
|
|
9
9
|
"palette": "sanctioned personalization surface — override freely, then run remarque-audit"
|