Dark-mode readability pass: soften the palette, bump the root type scale
release gate / check (push) Failing after 6m31s
release gate / check (push) Failing after 6m31s
A user reported dark mode (white-on-black) is harder to read than light mode. Root cause is halation, not size alone: the dark tokens ran 98% foreground on a 3.9%-lightness background (~19:1 contrast), and bright text on near-black visually bleeds — worst for astigmatic readers, and light-on-dark renders perceptually thinner at the same size. Palette (web/app/globals.css .dark tokens): background 3.9% -> 10%, foreground 98% -> 92% (body contrast ~13:1, still ~2x WCAG AAA), card/popover 6% -> 13%, sidebar 5.5% -> 8% (stays darker than content), secondary/muted/border/input 15.9% -> 19% so surface steps survive the lighter base; muted-foreground unchanged at ~7.4:1 (AAA). Type scale: html root 106.25% (16 -> 17px) — a global bump, so every rem-based text AND spacing scales proportionally in both themes. Deliberately not per-theme: a dark-only font size would reflow layouts on every theme toggle. Font-smoothing left untouched (the antialiased-off trick is a pre-Mojave artifact and risks blur). STYLE_GUIDE.md records both decisions, including a dark-theme readability rule (keep body copy ~11:1-14:1; never reintroduce pure white on <5% backgrounds) so future token work cannot silently undo this. Web lint/SSR-eslint/build clean. CI browser regressions are the gate to watch for the 6.25% global scale-up.
This commit is contained in:
@@ -22,6 +22,10 @@ The root layout, `app/layout.tsx`, is the single place for app-wide providers an
|
|||||||
|
|
||||||
**Size hierarchy:** Use Tailwind's scale. Headings: `text-4xl`→`text-3xl`→`text-2xl`→`text-xl`. Body: `text-base`→`text-sm`. Captions: `text-xs`.
|
**Size hierarchy:** Use Tailwind's scale. Headings: `text-4xl`→`text-3xl`→`text-2xl`→`text-xl`. Body: `text-base`→`text-sm`. Captions: `text-xs`.
|
||||||
|
|
||||||
|
The root font size is `106.25%` (17px) in `globals.css` — a deliberate global
|
||||||
|
bump; every rem-based size and spacing scales with it. Change it there only,
|
||||||
|
never per-theme (a per-theme font size reflows layouts on every toggle).
|
||||||
|
|
||||||
Always use `tracking-tight` on large headings (`text-2xl` and above).
|
Always use `tracking-tight` on large headings (`text-2xl` and above).
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -45,6 +49,14 @@ All colors use CSS variables — **never hardcode color values**.
|
|||||||
|
|
||||||
Usage: `bg-primary`, `text-muted-foreground`, `border-border`, etc.
|
Usage: `bg-primary`, `text-muted-foreground`, `border-border`, etc.
|
||||||
|
|
||||||
|
**Dark-theme readability rule:** the `.dark` tokens target ~13:1 body-text
|
||||||
|
contrast, not maximum. The original near-black bg (3.9% lightness) with
|
||||||
|
near-white text (98%) measured ~19:1 and caused halation (bright-on-black
|
||||||
|
text visually bleeds, worst for astigmatic readers) — user-reported
|
||||||
|
2026-10-29. When adding dark tokens keep body copy between ~11:1 and 14:1
|
||||||
|
(WCAG AAA is 7:1); never reintroduce pure `0 0% 100%` foreground on
|
||||||
|
`<5%` backgrounds.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Spacing Scale
|
## Spacing Scale
|
||||||
|
|||||||
+22
-14
@@ -50,24 +50,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--background: 240 10% 3.9%;
|
/* Readability pass (2026-10-29): the previous near-black bg (3.9%) with
|
||||||
--foreground: 0 0% 98%;
|
near-white text (98%) hit ~19:1 contrast — halation made body text
|
||||||
--card: 240 10% 6%;
|
bleed for a meaningful share of readers (esp. astigmatism). These
|
||||||
--card-foreground: 0 0% 98%;
|
values land body copy at ~13:1, still far above WCAG AAA (7:1). */
|
||||||
--popover: 240 10% 6%;
|
--background: 240 6% 10%;
|
||||||
--popover-foreground: 0 0% 98%;
|
--foreground: 0 0% 92%;
|
||||||
|
--card: 240 5% 13%;
|
||||||
|
--card-foreground: 0 0% 92%;
|
||||||
|
--popover: 240 5% 13%;
|
||||||
|
--popover-foreground: 0 0% 92%;
|
||||||
--primary: 245 60% 60%;
|
--primary: 245 60% 60%;
|
||||||
--primary-foreground: 0 0% 100%;
|
--primary-foreground: 0 0% 100%;
|
||||||
--secondary: 240 3.7% 15.9%;
|
--secondary: 240 4% 19%;
|
||||||
--secondary-foreground: 0 0% 98%;
|
--secondary-foreground: 0 0% 92%;
|
||||||
--muted: 240 3.7% 15.9%;
|
--muted: 240 4% 19%;
|
||||||
--muted-foreground: 240 5% 64.9%;
|
--muted-foreground: 240 5% 64.9%;
|
||||||
--accent: 245 30% 18%;
|
--accent: 245 30% 20%;
|
||||||
--accent-foreground: 245 60% 75%;
|
--accent-foreground: 245 60% 75%;
|
||||||
--destructive: 0 62.8% 30.6%;
|
--destructive: 0 62.8% 30.6%;
|
||||||
--destructive-foreground: 0 0% 98%;
|
--destructive-foreground: 0 0% 98%;
|
||||||
--border: 240 3.7% 15.9%;
|
--border: 240 4% 19%;
|
||||||
--input: 240 3.7% 15.9%;
|
--input: 240 4% 19%;
|
||||||
--ring: 245 60% 60%;
|
--ring: 245 60% 60%;
|
||||||
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.15), 0 1px 2px -1px rgb(0 0 0 / 0.15);
|
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.15), 0 1px 2px -1px rgb(0 0 0 / 0.15);
|
||||||
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.15);
|
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.15);
|
||||||
@@ -77,13 +81,17 @@
|
|||||||
--chart-3: 30 80% 55%;
|
--chart-3: 30 80% 55%;
|
||||||
--chart-4: 280 65% 60%;
|
--chart-4: 280 65% 60%;
|
||||||
--chart-5: 340 75% 55%;
|
--chart-5: 340 75% 55%;
|
||||||
--sidebar: 240 10% 5.5%;
|
--sidebar: 240 6% 8%;
|
||||||
--sidebar-foreground: 0 0% 85%;
|
--sidebar-foreground: 0 0% 85%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
html { scroll-behavior: smooth; }
|
/* 17px root (106.25%): a modest global type bump — every rem-based size
|
||||||
|
and spacing scales proportionally in BOTH themes. Deliberately not
|
||||||
|
dark-mode-only: a per-theme font size would reflow layouts on every
|
||||||
|
theme toggle. */
|
||||||
|
html { scroll-behavior: smooth; font-size: 106.25%; }
|
||||||
* { border-color: hsl(var(--border)); }
|
* { border-color: hsl(var(--border)); }
|
||||||
body {
|
body {
|
||||||
background-color: hsl(var(--background));
|
background-color: hsl(var(--background));
|
||||||
|
|||||||
Reference in New Issue
Block a user