dev604

Dark mode without the flash

The dreaded white flash happens when a page paints before JavaScript applies the saved theme. The fix is a few hundred bytes in the right place.

Apply before paint

A tiny inline script in <head> reads the visitor’s saved preference and sets data-theme on the root element before any CSS is evaluated.

var t = localStorage.getItem('ns-theme');
if (t) document.documentElement.dataset.theme = t;

Swap neutrals, keep the brand

Only the neutral palette is overridden in dark mode. Accent colours from whichever style variation is active carry straight through — so Ember stays orange and Grove stays green.

The toggle itself is a custom block built on the Interactivity API, so every toggle on the page stays in sync without a framework.

Good systems make good decisions easy. When the defaults are thoughtful, editors spend their energy on content instead of fighting the layout, and the site stays consistent long after launch.


Let’s talk

Let’s build something
worth the view