Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage map tiles dark mode with leaflet-osm plugin #4777

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

AntonKhorev
Copy link
Contributor

I guess #4769 meant "how about we use dark tile variants when available". If Transport Dark is approved to be used on the osm website, we can switch to it in dark mode when "Transport Map" is selected.

Here's how it can work together with prefers-color-scheme switching from #4761:

image
image
image
image

Layers without alternative dark tiles get dimmed, layers with switch to their alternative tiles.

I modified leaflet-osm in this repository directly. Is https://github.com/openstreetmap/leaflet-osm maintained? Its npm package was last updated years ago.

@AntonKhorev AntonKhorev force-pushed the x/dark-mode-tiles branch 2 times, most recently from 6a3f718 to 9a1d005 Compare May 10, 2024 16:05
@AntonKhorev
Copy link
Contributor Author

Added context menu options similar to "Map Brightness" dropdown in https://userstyles.world/style/15596/openstreetmap-dark-theme

image image

@AntonKhorev
Copy link
Contributor Author

AntonKhorev commented May 10, 2024

  • There's a bug when switching to a layer that comes earlier in the list because I assumed that "add" event happens after "remove" event.
  • Context menu is not translated.
  • Context menu selection is not remembered
  • No context menus on other maps like dashboard map, but maybe that's not needed if the selection is remembered
  • Selected filter doesn't affect map key

@pnorman
Copy link
Contributor

pnorman commented May 10, 2024

I modified leaflet-osm in this repository directly. Is https://github.com/openstreetmap/leaflet-osm maintained

Yes. It's had updates in the last 8 months, when we added or removed featured layers.

@tomhughes
Copy link
Member

Specifically I have maintainer access there ;-)

@AntonKhorev
Copy link
Contributor Author

Yes. It's had updates in the last 8 months, when we added or removed featured layers.

Supposedly not when layers are removed because L.OSM.OPNVKarte is still there. And it would be odd for this layer to disappear for anyone who is using leaflet-osm independently from the osm website.

@AntonKhorev AntonKhorev force-pushed the x/dark-mode-tiles branch 2 times, most recently from 47e8740 to 1fe297f Compare May 11, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants