← Back to context

Comment by ethan_smith

12 hours 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.

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