Files
Vijay Janapa Reddi 0215fd9e4d fix(theme): bridge into site-head.html and defend against Quarto's clobber
Two issues caught by local rendering of /about/license.html in dark mode:

1) The active source for the inline FOUC-prevention script is
   `shared/config/site-head.html`, NOT `shared/scripts/theme-persist.js`.
   Quarto inlines the contents of site-head.html into <head>; the
   standalone .js file is documentation-only ("kept identical for
   documentation/testability"). The previous patch only touched the
   .js file, so the .quarto-dark body-class bridge never reached the
   rendered page. Mirror the fix into site-head.html.

2) Even with the bridge in place, Quarto's own
   `toggleBodyColor(mode)` runs *after* this script and re-asserts
   the body class based on `mode`. When no `quarto-color-scheme`
   value is in localStorage (typical first visit), Quarto resolves
   `mode = 'light'` and clobbers our `.quarto-dark` class — even
   though the OS preference resolved `data-bs-theme="dark"` already.
   Result: dark `data-bs-theme` background with `.quarto-dark`-keyed
   CSS variables stuck at light defaults (the "Open by design."
   invisibility on /about/license.html, low-contrast hero/body text
   across about/community/newsletter pages).

   Defense: a MutationObserver on `body.class` and `html[data-bs-theme]`
   re-asserts the bridge whenever Quarto (or any other script) changes
   it. Cheap, idempotent, and surgical.

Verified locally with playwright + the about/license.html render:
  bodyClasses: ["nav-fixed", "fullcontent", "quarto-dark"]  ← was quarto-light
  h1Color:     rgb(229, 231, 235)                            ← was rgb(26,26,46)
  bodyAbText:  "#e5e7eb"                                     ← was "#1a1a2e"
2026-04-29 08:47:26 -04:00
..