ghybs / Leaflet.TileLayer.Fallback

Replaces missing Tiles by scaled lower zoom Tiles
Apache License 2.0
36 stars 18 forks source link

Greyscale support #16

Closed jpmeijers closed 5 years ago

jpmeijers commented 5 years ago

In a single project I am trying to use both the Fallback tile layer as well as the Grayscale tile layer (https://github.com/Zverik/leaflet-grayscale). Unfortunately I can't manage to use both at the same time. Does anyone have an idea how to do this?

ghybs commented 5 years ago

Hi,

Hum looks like trying to combine both will require customizing how the greyscale plugin uses its source image, at least.

Unfortunately I will not be able to provide support for that, but feel free to implement it yourself. Should you need help along the road, feel free to ask on Stack Overflow!

ghybs commented 5 years ago

Proposed solution on Stack Overflow: https://stackoverflow.com/questions/56208960/leaflet-tile-provider-with-fallback-and-grey-scale

Demo

Basically:

JavaScript:

L.tileLayer.fallback(urlTemplate, {
  className: 'toGrey'
}).addTo(map);

CSS:

.toGrey img {
  filter: grayscale(1);
}