arc.codes icon indicating copy to clipboard operation
arc.codes copied to clipboard

Improvement to dark mode selection

Open andybee opened this issue 3 years ago • 2 comments

As I understand the current dark mode implementation looks at the current browser/OS setting first and sets that as a default value, before letting the user customise via the top right toggle.

I have my OS set to flip from light to dark based on sunset/sunrise, so if I visit the site for the first time during the day I'm on the light theme and have to toggle it at sunset to dark, then back to light again the next day etc. (curse you, short daylight of winter!)

Could we add a third option for "OS/Browser default", or not persist a default setting and always check the browser's opinion on page load?

andybee avatar Mar 12 '22 09:03 andybee

Is doing that even possible? Not sure if I've seen that in the wild.

filmaj avatar Mar 24 '25 01:03 filmaj

Yep, it's a bit of jiggery pokery with either setting an explicit class on the body/html tag to force dark/light or relying on prefer-colour-scheme media selector.

https://web.dev/articles/prefers-color-scheme#the_prefers-color-scheme_media_query

andybee avatar Mar 24 '25 12:03 andybee