<p></p>
<p>I used this solution for dark theme in my app, <a href="https://issviewer.com" rel="nofollow">you can test it here</a>. <a href="https://github.com/pkrasicki/issviewer">Full source here</a>. I think it works pretty well in practice. Perhaps openstreetmap.org could do this too?</p>
<p>With Leaflet it's possible to apply a custom CSS class with the filter just to the map tiles themselves and that's what I did. This way it doesn't affect whatever you draw on the map. One other problem that I had to solve was that map tiles were too bright when they were loading - they had a light gray color.<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/49721209/100754991-9b3d2300-33e3-11eb-8c2c-ae02a990dbd7.png"><img src="https://user-images.githubusercontent.com/49721209/100754991-9b3d2300-33e3-11eb-8c2c-ae02a990dbd7.png" alt="leaflet-map-tiles-loading" style="max-width:100%;"></a></p>
<p>The solution was to simply change the background color of the map element:<br>
<code>background: #1f1f1f !important;</code></p>
<p>There is only one problem left. Since I applied the filter only to map tiles, the map controls still have the default white color. I haven't figured out how to apply a custom class for the controls in Leaflet yet.<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/49721209/100755164-ca539480-33e3-11eb-9423-a306a67c32a1.png"><img src="https://user-images.githubusercontent.com/49721209/100755164-ca539480-33e3-11eb-9423-a306a67c32a1.png" alt="leaflet-controls" style="max-width:100%;"></a></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/issues/2332#issuecomment-736597362">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMHJ7I7H6I3VOS4M2LSST6WFANCNFSM4IHLU3FA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLOEG6PLWPYYHFQBN4LSST6WFA5CNFSM4IHLU3FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFPTZK4Q.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/issues/2332#issuecomment-736597362",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2332#issuecomment-736597362",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>