Repository navigation
Commit 7062bdc
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 files changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments