JavaScript function to return “n” shades of a given color from (dark to light)

前端 未结 2 1557
孤城傲影
孤城傲影 2021-02-10 00:15

I would like to get the color range of the specific color for generating tag cloud.

Say that user has entered some color with RGB/HHHHHH values then I woul

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-10 00:25

    You want to operate on saturation and value, convert rgb to hsv first and then it is very easy.

    Code: http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript

    Info: http://en.wikipedia.org/wiki/HSL_and_HSV

提交回复
热议问题