简体   繁体   中英

Custom colored google maps marker

I am trying to add a custom colored marker to a map. I found this answer, which states that I need to feed a BitmapDescriptorFactory with a HUE color and give that to the .icon() method of the MarkerOptions , but when I am using a converter to get the HUE value for my color (#678E00), it gives me 3 values, (76,100,27.8), but I can only provide 1 number to the BitmapDescriptorFactory . Do you know how I could do this?

The HSL (Hue, Saturation, Lightness) representation of your Hex color (#678E00) is 76, 100, 27.8.

This means that the Hue of your color is 76 which is the value that you need to feed to the defaultMarker function:

.defaultMarker(76)

Take into account that you can only set the Hue of the marker and the Saturation and Lightness won't be modified so your color will be different than the original #678E00

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM