The HTML specification actually has a good solution to this, well better than the current JavaScript theme switchers that sites like Ars use.
But you can probably guess, even though it's a spec nobody follows it. Firefox is the closest, but it has a major issue that's gone ignored for over 16 years.
The preference isn't stored, each page reload resets to the default theme... See this and this and this and this
Although the style selector doesn't work in Firefox it does use the
Default-Style
HTTP
or HTML header. And that allows
me to do something really cool on my static site/no
js. I can have a dark or light theme based on a
HTTP header. So depending on
the current time nginx will send Default-Style: Light
or
Default-Style: Dark
and Firefox users will have a dark theme at
night! (UTC)
Chrome just flat out ignores the spec, pretends the spec doesn't exist.
Hopefully Firefox will fix the issues, Chrome will adopt the it and then with people thinking about it we'll beable to define the dark and light themes in a way that browsers can automatically do based on local time or user preference.
I vote for
<meta name="Dark-Style" content="Nighttime">
and
<meta name="Light-Style" content="Daytime">
where "Nighttime" and "Daytime" are the titles of alternate
stylesheets.