A small blocking `<script>` in the `<head>` that reads the saved preference from localStorage and sets a class on `<html>` before any rendering happens is the standard approach. You can also set `<meta name="color-scheme" content="dark light">` which tells the browser to use the OS preference for the initial paint, covering the default case without any JS at all.
how your users' browsers choose to render `about:blank` while waiting on your page to be delivered is outside of both your control and concern
on Gnome i've got system-wide dark mode turned on and idk, my Firefox is dark gray until it gets any content. so users have the power and should exercise it to tailor their experience as they wish
A small blocking `<script>` in the `<head>` that reads the saved preference from localStorage and sets a class on `<html>` before any rendering happens is the standard approach. You can also set `<meta name="color-scheme" content="dark light">` which tells the browser to use the OS preference for the initial paint, covering the default case without any JS at all.
That's still after the server's response arrives, they're talking about the blank browser page before anything comes back in the response.
Use `background-color` in Firefox's `userContent.css`.
I love the idea of ending it for myself, but my users are still screwed?
how your users' browsers choose to render `about:blank` while waiting on your page to be delivered is outside of both your control and concern
on Gnome i've got system-wide dark mode turned on and idk, my Firefox is dark gray until it gets any content. so users have the power and should exercise it to tailor their experience as they wish
I don't know if I misunderstand the problem, but what about a style tag at the earliest part of the page indicating the background color to use?
That flashbang happens during the initial latency (DNS, RTT, any server slowness).
make dark mode the default, then it's a flash of dark in either case
send a blank black page then load from there?
Decrease screen brightness. Turn off dark mode. No flashbang. Bonus: Battery lasts longer.