Dynamically change the color of a polygon in leaflet?
L.Circle
extends L.Path
(http://leafletjs.com/reference.html#path), that have method setStyle( <Path options> object )
, and you can apply new style as window.circle.setStyle({fillColor: '#dddddd'});
If you are looking for something like this:
const circle = L.circle([lat, lng], {
style: style,
onEachFeature: onEachFeature,
});
These options are available for geoJson data ie: L.geojson()..... :D
So, for polygon . Try,
circle.setStyle({
color: 'red'
});