简体   繁体   English

自定义彩色Google地图标记

[英]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 . 我找到了这个答案, 答案表明我需要使用HUE颜色.icon() BitmapDescriptorFactory并将其提供给MarkerOptions.icon()方法,但是当我使用转换器获取我的颜色的HUE值时(#678E00 ),它给了我3个值(76,100,27.8),但我只能向BitmapDescriptorFactory提供1个数字。 Do you know how I could do this? 你知道我该怎么做吗?

The HSL (Hue, Saturation, Lightness) representation of your Hex color (#678E00) is 76, 100, 27.8. 十六进制颜色(#678E00)的HSL(色相,饱和度,亮度)表示为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: 这意味着您的颜色的色相是76,这是您需要提供给defaultMarker函数的值:

.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 请注意,您只能设置标记的色相,并且不会修改“饱和度”和“亮度”,因此您的颜色将与原始#678E00

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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