How do change the color of icon markers in Google Maps?
Example:
var icon = {
url: 'custom.svg', // url
}
var marker = new google.maps.Marker({
position: {lat: p[1], lng: p[2]},
map: map,
icon: icon,
});
Inside var icon
I tried to fill color and color, but it did not change the color of the icon map marker. Does anybody know how to change the color?
Use following code -
let marker = new google.maps.Marker({
map: map,
position: {lat: -34.397, lng: 150.644},
icon: {
url: "http://maps.google.com/mapfiles/ms/icons/blue-dot.png"
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.