Commit e0588d4
fix(api): paint /api canvas synchronously to eliminate theme flash
The /api page flashed white on first load before settling into dark mode.
The head script already set <html data-theme> synchronously, but no CSS
in <head> keyed off that attribute — the only theme-aware CSS lived
inside Scalar's runtime-injected customCss (which keys off body classes
.dark-mode / .light-mode), and that CSS only existed after the Scalar
bundle (loaded mid-<body>) downloaded, parsed, and mounted.
Add an inline <style> in <head> that paints html (and inheriting body)
based on data-theme, so the canvas color is correct on the very first
frame. Scalar's customCss still drives the rest of the page once it
mounts.
Co-Authored-By: Oz <oz-agent@warp.dev>1 parent fc1c798 commit e0588d4
1 file changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
131 | 155 | | |
132 | 156 | | |
133 | 157 | | |
| |||
0 commit comments