By default, when leafletJS is loading a map, the background tiles are all grey. I'd like to change that color to be black (or any other arbitrary color). How can I go about doing this?
How can I change the default loading tile color in LeafletJS?
It's controlled by the below css rule in the file 'leaflet.css':
.leaflet-container {
background: #ddd;
}
so you just need to change this rule.
This isn't working for me, mid 2019. The property is set, and overwriting the underlying property, but the map still flashes the default grey when loading. –
Fides
Make sure to load your style sheet after the leaflet style sheet or append the rule with !important –
Truditrudie
This can also be done with
!important
without worrying about its ordering with respect to the leaflet style sheet. –
Hellebore © 2022 - 2024 — McMap. All rights reserved.