How can I change the default loading tile color in LeafletJS?
Asked Answered
I

1

23

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?

Ironlike answered 13/12, 2012 at 2:15 Comment(0)
I
41

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.

Indignant answered 13/12, 2012 at 2:37 Comment(3)
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 !importantTruditrudie
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.