开发者

convert HSL or HSV to RGB via jquery

开发者 https://www.devze.com 2022-12-19 07:15 出处:网络
I\'m looking to generate random \"similar\" colors using jquery. It is my understanding that th开发者_如何学运维e best way to approach this is using HSL or HSV, according to this question.

I'm looking to generate random "similar" colors using jquery.

It is my understanding that th开发者_如何学运维e best way to approach this is using HSL or HSV, according to this question.

The issue is I can't seem to figure out how to either…

  1. Use HSL or HSV with jquery; or
  2. Convert HSL or HSV to RBG via jquery

I found this color library, but i'd like to avoid plugins if at all possible. Any idea's?


Best idea ever: DIY :)

Write a simple conversion function. It'd be 4 lines of math

Look here for start: http://en.wikipedia.org/wiki/HSL_and_HSV

And use colors in CSS as follows

color: rgb(255, 255, 255);

And cut it up with string functions.

Still not sure what to do? Ask for details in comments ;)


See here, this looks like it would do everything: https://www.adaptavist.com/display/jQuery/Colour+Library

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号