Stylesheets
The accent is a preference too, but it is not in the path: it is a stylesheet. The root layout links to /theme/accent.css, and a request for it is rewritten, by the accent cookie, to one of four one-line files in public/. No page has a copy per accent.
The cookie says nothing; the CSS that was served says --accent-name: ….
Choosing writes the cookie and fetches the stylesheet again — a fresh link with a cache-busting query, after the layout's — so the change shows without a reload. The second line reads the answer back out of CSS: what the server chose is what the page uses, and a script can read it without parsing a cookie.
What the browser sees
GET /theme/accent.css
Cookie: accent=green
HTTP/1.1 200 OK
Cache-Control: private, no-cache, stale-if-error=86400
ETag: W/"..."
:root { --accent: #16a34a; --accent-name: "green" }
no-cache makes the browser ask again on every page, which is a 304 while the
cookie has not changed and a new file once it has. The file is a line, so a fresh copy is
barely heavier than the 304. On a reload the link is render-blocking CSS in the head, so the
first frame has the right accent.
Inspector
Notice that the preferences below do not mention the accent. It is not in the path, so it is not in the params.
- Address bar
- /en-GB/-/-/demos/stylesheets
- Rendered as
- /en-GB/-/-/-/-/demos/stylesheets
- Locale
- en-GB
- Preferences
- {}
- Flags
- {}