google-mapsgoogle-maps-api-2

How can I change the color of a Google Maps marker?


I'm using the Google Maps API to build a map full of markers, but I want one marker to stand out from the others. The simplest thing to do, I think, would be to change the color of the marker to blue, instead of red. Is this a simple thing to do or do I have to create a whole new icon somehow? If I do have to create a new icon, what's the easiest way to do that?


Solution

  • Since maps v2 is deprecated, you are probably interested in v3 maps: https://developers.google.com/maps/documentation/javascript/markers#simple_icons

    For v2 maps:

    http://code.google.com/apis/maps/documentation/overlays.html#Icons_overview

    You would have one set of logic do all the 'regular' pins, and another that does the 'special' pin(s) using the new marker defined.