You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gp-sphinx(fix[fowt]) Prevent flash of wrong theme on initial load
why: When localStorage.theme and OS prefers-color-scheme disagree
(e.g., user toggled to dark on a light-mode OS), the page briefly
paints the OS-default scheme before settling on the stored choice.
Furo's inline body-script runs after <body> opens, and the meta
color-scheme tag defers canvas color to OS, so the wrong scheme can
leak into first paint on slower networks/CPUs.
what:
- Add _inject_fowt_prevention() html-page-context callback that
injects a synchronous <head> snippet via metatags
- Snippet sets html.style.colorScheme to the resolved theme (canvas
paints correctly) and adds a gp-sphinx-theme-pending gating class
- New CSS rule hides body until Furo's body-script sets data-theme,
so any pre-script body paint is invisible
- DOMContentLoaded failsafe sets body[data-theme] from the
head-resolved value if Furo's body-script ever stops running
0 commit comments