← Back to Blog
Dark Mode, Automatically
Dark mode is usually either skipped entirely (leaving readers who prefer it stuck squinting
at a bright white page at night) or built as its own separate feature — a toggle button, a
cookie to remember the choice, twice the design work to maintain. Here it's neither: every
color on the site is a CSS custom property with a light value and a dark value, and the
browser's own prefers-color-scheme setting decides which set applies.
Practically, that means:
- A reader who has their phone or laptop set to dark mode system-wide sees this site in dark mode automatically — no toggle to find, no preference to set twice.
- There's nothing to maintain going forward: a new color added to the palette gets a light and a dark value at the same time, in the same place, rather than needing a parallel "dark mode stylesheet" kept in sync by hand.
- The same generated social-post images (see the AI social generator) render correctly regardless of the CMS's own theme — those are fixed-color PNG exports, unaffected by whatever theme the visitor's browser happens to be in.