<p></p>
<p>For anyone curious, here's how I implemented the insane dark mode slider on <a href="https://nsi.guide" rel="nofollow">https://nsi.guide</a><br>
<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/osmlab/name-suggestion-index/commit/2f68fe032e2388e576b66ed4e55128f53ff46358/hovercard" href="https://github.com/osmlab/name-suggestion-index/commit/2f68fe032e2388e576b66ed4e55128f53ff46358">osmlab/name-suggestion-index@<tt>2f68fe0</tt></a></p>
<p>It's really just a set of css rules that take effect if <code>.dark</code> class is added to the document root.<br>
You don't need to add all the media queries to the .css because JavaScript has a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia" rel="nofollow"><code>window.matchMedia</code></a> function that can give you that answer.</p>
<p>This implementation respects the user's dark mode preference the first time, then uses whatever is stored in local storage every time after that.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3028#issuecomment-756135379">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLI6YBSIC7ZUD44AM6DSYW5PDANCNFSM4VQTNSCA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLMQBX7Z6G3R4F6LZETSYW5PDA5CNFSM4VQTNSCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFUI3LUY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3028#issuecomment-756135379",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3028#issuecomment-756135379",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>