Skip to content

Commit 7062bdc

Browse files
authored
fix(docs): stop forcing thin font smoothing on the dark site (#506)
## Cause The docs set `-webkit-font-smoothing: antialiased` and `-moz-osx-font-smoothing: grayscale` on `html`, in two places: - `docs/style.css`, which the docs pages use - the inline `<style>` in `docs/index.html` (the homepage) On macOS, this setting removes the small stroke thickening that the system normally adds. As a result, small grey regular-weight text on the dark background looks thin and grainy, while bold headings look fine. No other page under `docs/` sets smoothing. ## Fix The site is **always dark**. It has no `prefers-color-scheme` query, no `data-theme`, and no light tokens. So the fix removes the forced smoothing everywhere, and the browser falls back to the platform default (`auto`). A short comment marks the spot so the override does not come back. No colours, sizes or weights change. ## Red/green: ink measurement on the real pages I served the pre-fix docs (`git archive` of 7ff0e49) and the fixed docs with `python3 -m http.server` and loaded them in Playwright on macOS at 1440x900 @2x. Each crop is the first regular-weight `--text-secondary` (`#8888a0`) paragraph on the page, on the `#0a0a0f` background. Ink = mean luminance above the background over the crop; glyph = mean over glyph pixels only. Higher means fuller. | Engine / page (text size) | Smoothing | Ink (crop) | Ink (glyph px) | |---|---|---|---| | Chromium / chat-completions (16px) | before: antialiased | 9.99 | 88.66 | | | **after: auto** | **12.54** (+26%) | **99.59** | | Chromium / home (13.6px) | before: antialiased | 8.66 | 37.45 | | | **after: auto** | **10.21** (+18%) | **43.99** | | WebKit / chat-completions (16px) | before: antialiased | 9.97 | 88.68 | | | **after: auto** | **12.56** (+26%) | **94.88** | | WebKit / home (13.6px) | before: antialiased | 9.01 | 37.47 | | | **after: auto** | **10.91** (+21%) | **44.71** | ## Light mode The site has no light mode, so there is nothing to keep pixel-identical. To confirm this, I emulated `prefers-color-scheme: light` and compared it with dark on the same build: - 0 differing pixels at iPhone SE and iPhone 14 Pro Max, on both pages, before and after the fix. - 0 differing pixels on desktop chat-completions. - On desktop home, about 1.2k–1.5k pixels differ both before and after. This is not caused by the fix, which is the same in both schemes. I did not confirm the cause; it is probably the animated hero. Contrast does not change, because no colour values change. ## Screenshots I took screenshots at iPhone SE (375x667), iPhone 14 Pro Max (430x932) and Desktop (1440x900) for the homepage and `/chat-completions/`, before and after, and checked them by eye: - Layout, wrapping and colours are identical. - Grey body text, the sidebar and the "On this page" links have fuller, less grainy strokes after the fix. - Bold headings and the monospace code blocks look unchanged. ## Dark text on the green accent The fix also touches dark text on the bright green accent: `.btn-primary` (600 weight, 14px mono) and `th.col-aimock` (600 weight, 12.8px). I took before/after crops of both on the homepage at Desktop (1440x900) and iPhone SE (375x667), @2x, and checked them by eye: - After the fix, the strokes are slightly heavier. - The counters (a, e, o, R, &) stay open, and the edges stay crisp. - Both stay legible and are not blobby. ## Checks - `prettier --check docs/style.css docs/index.html` passes.
2 parents 7ff0e49 + 1cc3d3c commit 7062bdc

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎docs/index.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
html {
8989
font-size: 16px;
9090
scroll-behavior: smooth;
91-
-webkit-font-smoothing: antialiased;
92-
-moz-osx-font-smoothing: grayscale;
91+
/* No font-smoothing override: forcing antialiased turns off macOS stroke
92+
thickening, so thin grey text renders too thin on this dark background. */
9393
}
9494

9595
body {

‎docs/style.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
html {
3636
font-size: 16px;
3737
scroll-behavior: smooth;
38-
-webkit-font-smoothing: antialiased;
39-
-moz-osx-font-smoothing: grayscale;
38+
/* No font-smoothing override: forcing antialiased turns off macOS stroke
39+
thickening, so thin grey text renders too thin on this dark background. */
4040
}
4141

4242
body {

0 commit comments

Comments
 (0)