Original author here. I don't like the idea of using JS on my website and I don't think that it is possible to create a light/dark mode switch with only CSS.
But you are right, most users don't know how to do that.
Cool thank you for sharing this! I might implement this on my site.
You can! Trick is to use the checkbox:selected hack to apply styles, in addition to the colour-scheme media query.
However, it would probably be possible with very minimal JS a la how Tailwind does it, toggling a .dark class in the body element and setting the dark mode variables and colors there.
But adding onclick and window.open() JS functions is somehow justifiable, over using simple <a> links? Of course, there might be some specific case you are solving here, so it would be very educational to hear this out.
Would be perfectly reasonable to use js over this feature.
Yes for sure, but my personal policy is not using JS. Anyway my site doesn't have so many visitors ;-) People come, stay for a few seconds and then leave forever.