0

How can I add a custom background color for the maps tile layers. using css class?

function initLayer(item, map) {
  const stateLayer = L.geoJSON(item, {
    style: function(feature) {
       return {
        weight: 8,
        opacity: 1,
        color: '#333',
        fillOpacity: 1,
        className: 'gradient-class' // add custom class
      }
    },
  });
  map.addLayer(stateLayer);
} 
Tinkerer
  • 59
  • 6
  • You cannot change the tiles' color. Tiles are a set of images. You can only use different tile provider – kboul Apr 27 '20 at 11:44

1 Answers1

2

You can change the background of the map. (By default the grey background when loading tiles)

#map{
   background-color: #bb4040;
}

If you wnat to change the tile color you can use a css filter: https://stackoverflow.com/a/60431006/8283938

Falke Design
  • 10,635
  • 3
  • 15
  • 30