ShortTechDE / ingenious

🎨 The Ghost theme that powers ShortTech. All rights reserved.
https://shorttech.de
Other
6 stars 2 forks source link

Dark mode switch #27

Open tobimori opened 4 years ago

tobimori commented 4 years ago

Make darkmode switchable without prefers-color-scheme

Dorson commented 4 years ago

The CSS rule for @media screen and (prefers-color-scheme: dark) { } would work, but it would enforce one color only, and for the users that have that browser / app setting ON already. No way to switch it ON, OFF quickly during sunny moments. Or give it to all as a click-able option.

To resolve that, I did the hard work.

Made and tested the code for a CSS color switch with memory. Great for the night and evening time.

See live demo on GitHub page:

https://dorson.github.io/CSS-Dark-Mode-and-color-switch/

Have fun, feel free to fork, copy, adopt, port, etc...