A visitor could pick dark on one of my sites and get light back on the next
I run three different web addresses under the same business: a personal site, this blog, and a course site. Anyone who reads on one and clicks through to another expects it to feel like the same place, not three separate rooms that forgot they know each other. The one thing that broke that feeling was something as small as light or dark mode.
Each site remembered a visitor’s choice its own way, in a little notebook only that address could read. Pick dark on the main site, land on the blog, and the blog had never seen that visitor before as far as it was concerned. Default light. Flip it there, go back to the main site later, and it would forget again. Three sites, three separate memories, one visitor stuck resetting the same preference over and over.
The fix was to stop keeping three notebooks and keep one that all three addresses are allowed to read. The choice now lives in a cookie, a small file a browser holds onto and hands back to a site on every visit, scoped to the domain shared by all three instead of to any one of them. Whichever address a visitor lands on next already knows what they picked.
The part that almost broke the fix was quieter than the bug it replaced. For a while, “never chose a theme” and “chose light” looked identical: both were just an absent record. That is a real problem the moment one of your systems has an older memory of its own to fall back on. A visitor who had picked dark on the main site months back, then landed on the blog first this time and picked light, left no record behind saying so. The main site’s older memory read that as still dark and pulled everything back to it. The fix underneath the fix was making sure “nothing chosen” and “chose light” could never be the same value again.
If your business shows up in more than one place, a phone line, a booking page, a storefront, a customer’s choice on one of them should not have to be repeated on the next. An absent record has to mean exactly one thing, or eventually it gets read back as whatever it happened to default to.