Super Simple Way to Change Leaflet Marker Color
Photo by henry perks on Unsplash
Is there a way to randomly change marker-colors in native Leaflet? Many ways demonstrated in Leaflet changing Marker color.
Here is a super simple way without swallowing up the documentation to achieve your goal presented by sil.
A cheap way to change the Leaflet marker colour is to use the CSS
filter
property. Give the icon an extra class and then change its colour in the stylesheet
|
|
And this will produce a red marker: alter the value given to hue-rotate
to alter the colour. Like my example — 臺灣清冠一號地圖 Taiwan NRICM101 Map (chienhsiang-hung.github.io).
Contact me: Hung, Chien-Hsiang (chienhsiang-hung.github.io)