Александр
Александр

Reputation: 113

How can I fill color the tile leaflet?

This cite uses tiles from here, but in the initial state they are gray.

How can I fill tiles to make them look like in the example?

I use this code:

map = L.map('map', {zoomControl: false}).setView([..., ...], 15);
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"', {}).addTo(map);

Images:

needful: needful original - light all: original - light all

Upvotes: 1

Views: 3842

Answers (2)

jllodra
jllodra

Reputation: 1478

You can use the ColorFilter plug-in with ['grayscale:100%'].

See some Demos.

Upvotes: 2

IvanSanchez
IvanSanchez

Reputation: 19049

There are a few approaches to this problem:

The map at coinmap.org (the site mentioned in the question) uses a CSS filter (filter:saturate(4)) on all the tiles (on the CSS selector .map .leaflet-tile-pane)

Upvotes: 4

Related Questions