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
-14
@@ -50,24 +50,28 @@
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: 240 10% 3.9%;
|
||||
--foreground: 0 0% 98%;
|
||||
--card: 240 10% 6%;
|
||||
--card-foreground: 0 0% 98%;
|
||||
--popover: 240 10% 6%;
|
||||
--popover-foreground: 0 0% 98%;
|
||||
/* Readability pass (2026-10-29): the previous near-black bg (3.9%) with
|
||||
near-white text (98%) hit ~19:1 contrast — halation made body text
|
||||
bleed for a meaningful share of readers (esp. astigmatism). These
|
||||
values land body copy at ~13:1, still far above WCAG AAA (7:1). */
|
||||
--background: 240 6% 10%;
|
||||
--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-foreground: 0 0% 100%;
|
||||
--secondary: 240 3.7% 15.9%;
|
||||
--secondary-foreground: 0 0% 98%;
|
||||
--muted: 240 3.7% 15.9%;
|
||||
--secondary: 240 4% 19%;
|
||||
--secondary-foreground: 0 0% 92%;
|
||||
--muted: 240 4% 19%;
|
||||
--muted-foreground: 240 5% 64.9%;
|
||||
--accent: 245 30% 18%;
|
||||
--accent: 245 30% 20%;
|
||||
--accent-foreground: 245 60% 75%;
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 240 3.7% 15.9%;
|
||||
--input: 240 3.7% 15.9%;
|
||||
--border: 240 4% 19%;
|
||||
--input: 240 4% 19%;
|
||||
--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-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-4: 280 65% 60%;
|
||||
--chart-5: 340 75% 55%;
|
||||
--sidebar: 240 10% 5.5%;
|
||||
--sidebar: 240 6% 8%;
|
||||
--sidebar-foreground: 0 0% 85%;
|
||||
}
|
||||
}
|
||||
|
||||
@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)); }
|
||||
body {
|
||||
background-color: hsl(var(--background));
|
||||
|
||||
Reference in New Issue
Block a user