Advertisement
12Me21

aaaaaaaaaaaaaaa

Jul 29th, 2016
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. var HSL2RGB=(h,s,l)=>{h*=6
  2. var c=(1-Math.abs(2*l-1))*s
  3. var r=[,,,].fill(l-c/2);var H=++h|0
  4. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  5. return r.map(x=>(x*(x<=1)+(x>1))*255|0)}
  6. //HSL all 0-1
  7.  
  8.  
  9. t=(a,b,c)=>{a*=6;b=[c+=b*=c<.5?c:1-c,c-a%1*b*2,c-=b*=2,c,c+a%1*b,c+b];return[b[~~a%6],b[(a|16)%6],b[(a|8)%6]].map(x=>x*255|0)}
  10.  
  11. HSLtoRGB=(a,b,c)=>{a*=6;b=[c+=b*=c<.5?c:1-c,c-a%1*b*2,c-=b*=2,c,c+a%1*b,c+b];return[b[~~a%6],b[(a|16)%6],b[(a|8)%6]].map(x=>x*255|0)}
  12.  
  13. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  14. c=(1-Math.abs(2*l-1))*sr=[,,,].fill(l-c/2)
  15. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  16. return r.map(x=>(x*(x<=1)+(x>1))*255|0)}
  17.  
  18. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  19. c=(1-Math.abs(2*l-1))*sr=[,,,].fill(l-c/2)
  20. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  21. return r.map(x=>(x*(x<=1)+(x>1))*255|0)}
  22.  
  23. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  24. a=b=>b<0?-b:b;c=(1-a(2*l-1))*s;
  25. r=[,,,].fill(l-c/2)r[H/2%3|0]+=c;
  26. r[2-H%3]+=a(h%2-1)
  27. return r.map(x=>(x<=1?x:1)*255|0)}
  28.  
  29. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  30. c=(1-Math.abs(2*l-1))*s;r=[,,,].fill(l-c/2)
  31. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  32. return r.map(x=>(x<=1?x:1)*255|0)}
  33.  
  34. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  35. c=(1-Math.abs(2*l-1))*s;r=[,,0].fill(l-c/2)
  36. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  37. return r.map(x=>(x<=1?x:1)*255|0)}
  38.  
  39. 1-Math.abs(2*l-1)
  40. l<.5?2*l:2-2*l
  41.  
  42. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  43. c=(l<.5?2*l:2-2*l)*s;r=[,,0].fill(l-c/2)
  44. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  45. return r.map(x=>(x<=1?x:1)*255|0)}
  46.  
  47. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0;l*=2
  48. c=(l<1?l:2-l)*s;r=[,,0].fill(l/2-c/2)
  49. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  50. return r.map(x=>(x<1?x:1)*255|0)}
  51.  
  52. (l<.5?2*l:2-2*l)*s
  53. (l<.5?l:1-l)*2*s
  54. l</2
  55.  
  56.  
  57. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  58. c=(l<.5?l:1-l)*2*s;r=[,,0].fill(l-c/2)
  59. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  60. return r.map(x=>(x<1?x:1)*255|0)}
  61. (l<.5?l:1-l)
  62. ((l<.5)--l)
  63.  
  64. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0 //bad
  65. c=((l<.5)-l)*2*s;r=[,,0].fill(l-c/2)
  66. r[H/2%3|0]+=c;r[2-H%3]+=Math.abs(h%2-1)
  67. return r.map(x=>(x<1?x:1)*255|0)}
  68.  
  69.  
  70. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0
  71. s*=l<.5?l:1-l;r=[,,0].fill(l-s)
  72. r[H/2%3|0]+=s*2;r[2-H%3]+=Math.abs(h%2-1)
  73. return r.map(x=>(x<1?x:1)*255|0)}
  74.  
  75. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0//
  76. s*=l<.5?l:1-l;r=[,,0]
  77. r[H/2%3|0]+=s*2;r[2-H%3]+=Math.abs(h%2-1)
  78. return r.map(x=>(x+=l-s<1?x:1)*255|0)}
  79.  
  80.  
  81. ((x+=l-s)<1?x:1)
  82. (x+=l-s<1?x:1)
  83.  
  84. HSL2RGB=(h,s,l)=>{h*=6;H=++h|0;r[2]=0
  85. s*=l<.5?l:1-l
  86. r[H/2%3|0]=s*2;r[2-H%3]=Math.abs(h%2-1)
  87. return r.map(x=>((x+=l-s)<1?x:1)*255|0)}
  88.  
  89. HSLtoRGB=(h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0;r[2]=0;r[H/2%3|0]=s*2;r[2-H%3]=Math.abs(h%2-1);return r.map(x=>((x+=l-s)<1?x:1)*255|0)}
  90. HSLtoRGB=(a,b,c)=>{a*=6;b=[c+=b*=c<.5?c:1-c,c-a%1*b*2,c-=b*=2,c,c+a%1*b,c+b];return[b[~~a%6],b[(a|16)%6],b[(a|8)%6]].map(x=>x*255|0)}
  91.  
  92. function(a,b,c){a*=6;b=[c+=b*=c<.5?c:1-c,c-a%1*b*2,c-=b*=2,c,c+a%1*b,c+b];return[b[~~a%6],b[(a|16)%6],b[(a|8)%6]]}
  93. (h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0;r[2]=0;r[H/2%3|0]=s*2;r[2-H%3]=Math.abs(h%2-1);return r.map(x=>((x+=l-s)<1?x:1)*255|0)}
  94. (a,b,c)=>{a*=6;b=[c+=b*=c<.5?c:1-c,c-a%1*b*2,c-=b*=2,c,c+a%1*b,c+b];return[b[~~a%6],b[(a|16)%6],b[(a|8)%6]].map(x=>x*255|0)}
  95.  
  96.  
  97. (h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0;r[2]=0;r[H/2%3|0]=s*2;r[2-H%3]=Math.abs(h%2-1)*s;return r.map(x=>((x+=l-s)<1?x:1)*255|0)}
  98.  
  99. h*=6
  100. c=(1-Math.abs(2*l-1))*s
  101. H=++h|0
  102. r=[,,,].fill(l-c/2);
  103. r[H/2%3|0]+=c;
  104. r[2-H%3]+=Math.abs(h%2-1)*c
  105. return r.map(x=>(x*(x<=1)+(x>1))*255|0)
  106.  
  107.  
  108. h*=6
  109. s*=l<.5?l:1-l
  110. H=++h|0
  111. var r=[0,0,0]
  112. r[H/2%3|0]=s*2
  113. r[2-H%3]=Math.abs(h%2-1)*s*2
  114. return r.map(x=>((x+=(l-s))<1?x:1)*255|0)
  115.  
  116. h*=6
  117. s*=l<.5?l:1-l
  118. H=++h|0
  119. var r=[,,0].fill(l-s)
  120. r[H/2%3|0]+=s*2
  121. r[2-H%3]+=Math.abs(h%2-1)*s*2
  122. return r.map(x=>(x<1?x:1)*255|0)
  123.  
  124. h*=6
  125. s*=l<.5?l:1-l
  126. H=++h|0
  127. l-=s
  128. var r=[0,0,0]
  129. r[H/2%3|0]=2
  130. r[2-H%3]=Math.abs(h%2-1)*2
  131. return r.map(x=>(x*s+l<1?x*s+l:1)*255|0)
  132.  
  133. h*=6
  134. s*=l<.5?l:1-l
  135. H=++h|0
  136. l-=s
  137. var r=[2,2,2]
  138. r[2-H%3]*=Math.abs(h%2-1)
  139. r[(H/2+2)%3|0]=0
  140. return r.map(x=>x*s*l*255|0).mapx=>x<1?x:1)
  141.  
  142.  
  143. h*=6
  144. s*=l<.5?l:1-l
  145. H=++h|0
  146. l-=s
  147. var r=[0,0,0]
  148. r[H/2%3|0]=2
  149. r[2-H%3]=Math.abs(h%2-1)*2
  150. return r.map(x=>(x*s+l<1?x*s+l:1)*255|0)
  151.  
  152.  
  153. h*=6
  154. s*=l<.5?l:1-l
  155. H=++h|0
  156. l-=s
  157. var r=[0,0,0]
  158. r[H/2%3|0]=2*s
  159. r[2-H%3]=Math.abs(h%2-1)*2*s
  160. return r.map(x=>(x+=l<1?x:1)*255|0)
  161.  
  162. (h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0;l-=s;r=[l,l,l];r[H/2%3|0]+=2*s;r[2-H%3]+=Math.abs(h%2-1)*2*s;return r.map(x=>( x <1?x:1)*255|0)}
  163. (h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0; r=[0,0,0];r[H/2%3|0] =s*2;r[2-H%3] =Math.abs(h%2-1); return r.map(x=>((x+=l-s)<1?x:1)*255|0)}
  164.  
  165.  
  166. (h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0;r=[l-=s,l,l];r[H/2%3|0]+=2*s;r[2-H%3]+=Math.abs(h%2-1)*2*s;return r.map(x=>( x <1?x:1)*255|0)}
  167. (h,s,l)=>{h*=6;s*=l<.5?l:1-l;H=++h|0;r=[0 ,0,0];r[H/2%3|0] =s*2;r[2-H%3] =Math.abs(h%2-1)*2*s;return r.map(x=>((x+=l-s)<1?x:1)*255|0)}
  168.  
  169.  
  170.  
  171. HSLtoRGB=(h,s,l)=>{h*=6;
  172. H=++h|0;s*=l<.5?l:1-l;
  173. r=[l-=s,l,l];r[H/2%3|0]+=2*s;
  174. r[2-H%3]+=Math.abs(h%2-1)*2*s;
  175. return r.map(x=>(x<1?x:1)*255|0)}
  176.  
  177. HSLtoRGB=(a,b,c)=>{a*=6;
  178. b=[c+=b*=c<.5?c:1-c,c-a%1*b*2,c-=b*=2,c,c+a%1*b,c+b];
  179. return[b[~~a%6],b[(a|16)%6],b[(a|8)%6]].map(x=>x*255|0)}
  180.  
  181.  
  182. (h,s,l)=>{h*=6;H=++h|0;s*=l<.5?l:1-l;r=[l-=s,l,l];r[H/2%3|0]+=2*s;r[2-H%3]+=Math.abs(h%2-1)*2*s;return r.map(x=>x*255)}
  183. HSLtoRGB=(h,s,l)=>{h=h*6+1;s*=l<.5?l:1-l;r=[l-=s,l,l];r[h/2%3|0]+=2*s;r[2-h%3|0]+=Math.abs(h%2-1)*2*s;return r.map(x=>(x<1?x:1)*255|0)}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement