Hacker News new | ask | show | jobs
by ethan_smith 52 days ago
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.
1 comments

That's still after the server's response arrives, they're talking about the blank browser page before anything comes back in the response.