RGB value to HSL converter

前端 未结 4 1936
余生分开走
余生分开走 2021-01-12 04:12

Google maps api v3 allows \"styles\" to be applied to the map, including setting the color of various features. However, the color format it uses is HSL (or what seems like

4条回答
  •  [愿得一人]
    2021-01-12 04:31

    I needed to match colors exactly. So I used the tool that @stadt.werk offers (http://googlemapscolorizr.stadtwerk.org/) to get close.

    But then I ran into the problem explained by @bukzor where the Google Maps API creates variations on your shade, none of which seem to be exactly what I specified.

    So I pulled up the map in a browser, took a screenshot of just the area with the two shades that weren't quite matching, opened it up in an image editor (pixlr.com, in my case), used the color-sucker tool to get the saturation and lightness for the shade, adjusted my saturation and/or lightness in the Google API call by 1, and repeated until I got something that seems to match perfectly.

    It is possible, of course, that Google Maps API will do different things with the colors on different devices/browsers/etc., but so far, so good.

    Tedious, yes, but it works.

提交回复
热议问题