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

[UX] Dark mode should change map into Dark Mode as well #199

Closed
Talie5in opened this issue May 16, 2024 · 7 comments · Fixed by #221
Closed

[UX] Dark mode should change map into Dark Mode as well #199

Talie5in opened this issue May 16, 2024 · 7 comments · Fixed by #221
Labels
enhancement New feature or request

Comments

@Talie5in
Copy link
Sponsor

Dark mode setting should change map into Dark Mode as well, the bright map can cause eye strain when working in darker environments.

@Hunter275
Copy link
Member

Hunter275 commented Jun 7, 2024

The map is created using react-map-gl as a wrapper for Mapbox GL JS.

The map images themselves come from OpenStreetMap Carto as a raster as defined in this json file that we use to define our mapStyle:

mapStyle="https://raw.githubusercontent.com/hc-oss/maplibre-gl-styles/master/styles/osm-mapnik/v8/default.json"

Because the map is a raster it would be difficult to change the look of it, and OpenStreetMap does not offer a dark mode for the map.

@Hunter275
Copy link
Member

#33 could possibly solve this

@Talie5in
Copy link
Sponsor Author

Talie5in commented Jun 7, 2024

@Hunter275
Copy link
Member

Hunter275 commented Jun 7, 2024

maplibre-gl just styles maps it does not source the map itself.

The source of the map for those two styles is:

    },
    "openmaptiles:version": "3.x",
    "openmaptiles:mapbox:owner": "openmaptiles",
    "openmaptiles:mapbox:source:url": "mapbox://openmaptiles.4qljc88t",
    "maputnik:renderer": "mbgljs"
  },
  "sources": {
    "openmaptiles": {
      "type": "vector",
      "url": "mbtiles://{v3}"
    }
  },

Meaning the map tiles come from Mapbox, which is a paid service. Mapbox is providing their map as a vector which allows for creating custom layers:

{
      "id": "water",
      "type": "fill",
      "source": "openmaptiles",
      "source-layer": "water",
      "filter": ["==", "$type", "Polygon"],
      "layout": {"visibility": "visible"},
      "paint": {"fill-color": "rgba(7, 43, 76, 1)", "fill-antialias": false}
    },

OpenStreetMap is free but their map comes as a raster image instead of a vector so there is no ability for styling.

@KyleMaas
Copy link

KyleMaas commented Jun 7, 2024

How about adding a CSS filter: invert(100%) to the map canvas? Trying that on my end, the map looks great.

@Hunter275
Copy link
Member

Hunter275 commented Jun 7, 2024

Inverted doesn't look horrible, I agree.

We would need to invert any of the Node icons on the map so they're back to being the correct color.

image

@Hunter275
Copy link
Member

https://meshmap.net/ uses the same hack on their map just with invert(1) hue-rotate(180deg) brightness(1.25)

@Hunter275 Hunter275 added enhancement New feature or request planned labels Jun 15, 2024
@Hunter275 Hunter275 linked a pull request Jun 15, 2024 that will close this issue
@Hunter275 Hunter275 removed the planned label Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants