[openstreetmap/openstreetmap-website] Introduce Dark Mode (WIP) (#3028)
Bryan Housel
notifications at github.com
Thu Jan 7 14:04:33 UTC 2021
For anyone curious, here's how I implemented the insane dark mode slider on https://nsi.guide
https://github.com/osmlab/name-suggestion-index/commit/2f68fe032e2388e576b66ed4e55128f53ff46358
It's really just a set of css rules that take effect if `.dark` class is added to the document root.
You don't need to add all the media queries to the .css because JavaScript has a [`window.matchMedia`](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) function that can give you that answer.
This implementation respects the user's dark mode preference the first time, then uses whatever is stored in local storage every time after that.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3028#issuecomment-756135379
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210107/c136c0ae/attachment.htm>
More information about the rails-dev
mailing list