Posted on
Nice! I had to turn on the "Patch CSP to allow style assets" option in the Styl-us settings, but it works. - phoebos
Posted on
Hmm, I'm resistant to installing extensions... dark mode toggling without JS is totally doable https://endtimes.dev/no-javascript-dark-mode-toggle/ but you're right that without cookies it would be tricky to persist preference.
Posted on
The problem with the extension is that this should be core functionality of the user agent. It is less about avoiding JS, and more about giving control to the user. With the extension, you can add dark mode to any website. With a server-side solution, you have to ask me (or someone else) to apply the change, or you're out of luck. (I also won't add it due the technical ugliness of adding purely presentational elements to a website which is supposed to be only content.) --dcz
Posted on
Hi! I don't see it mentioned, but with the "prefers-color-scheme" CSS property. You can put both color styles in the same CSS file, the client will automatically switch to light/dark mode according to the its system preference, no cookie, js or extensions needed :-) More info at: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
Posted on
Yeah, there's the CSS property. I intentionally didn't mention it because it doesn't solve the problem. The website author is still in the driver's seat, and the user can only choose between 2 destinations. This in no way integrates into user's preferred theme as a whole.