-
Notifications
You must be signed in to change notification settings - Fork 1
/
hsluv.min.js
10 lines (10 loc) · 4.55 KB
/
hsluv.min.js
1
2
3
4
5
6
7
8
9
10
(function(){function l(){}function g(){}function f(){}f.G=function(a){a=a.charCodeAt(1);return a!=a?void 0:a};f.substr=function(a,b,c){if(null!=b&&0!=b&&null!=c&&0>c)return"";null==c&&(c=a.length);0>b?(b=a.length+b,0>b&&(b=0)):0>c&&(c=a.length+c-b);return a.substr(b,c)};g.l=function(a){var b=parseInt(a,10);0!=b||120!=f.G(a)&&88!=f.G(a)||(b=parseInt(a));return isNaN(b)?null:b};l.P=function(a){var b="";do b="0123456789ABCDEF".charAt(a&15)+b,a>>>=4;while(0<a);for(;2>b.length;)b="0"+b;return b};var b=
b||{};b.b=function(){};b.b.ia=function(a,b){var c=(a.h-b.h)/(b.c-a.c);return{x:c,y:a.c*c+a.h}};b.b.ha=function(a){return Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2))};b.b.O=function(a){return Math.abs(a.h)/Math.sqrt(Math.pow(a.c,2)+1)};b.b.ka=function(a,b){var c=-1/a.c;return{c:c,h:b.y-c*b.x}};b.b.ga=function(a){return Math.atan2(a.y,a.x)};b.b.ja=function(a){var b=2*Math.PI;return(a%b+b)%b};b.b.aa=function(a,b){return b.h/(Math.sin(a)-b.c*Math.cos(a))};b.a=function(){};b.a.I=function(a){for(var d=[],
c=Math.pow(a+16,3)/1560896,c=c>b.a.H?c:a/b.a.m,h=0;3>h;)for(var k=h++,e=b.a.g[k][0],f=b.a.g[k][1],k=b.a.g[k][2],g=0;2>g;){var l=g++,m=(632260*k-126452*f)*c+126452*l;d.push({c:(284517*e-94839*k)*c/m,h:((838422*k+769860*f+731718*e)*a*c-769860*l*a)/m})}return d};b.a.v=function(a){a=b.a.I(a);for(var d=1.7976931348623157E308,c=0;2>c;)var h=c++,d=Math.min(d,b.b.O(a[h]));return d};b.a.u=function(a,d){for(var c=d/360*Math.PI*2,h=b.a.I(a),e=1.7976931348623157E308,f=0;f<h.length;){var g=h[f];++f;g=b.b.aa(c,
g);0<=g&&(e=Math.min(e,g))}return e};b.a.f=function(a,b){for(var c=0,h=0,e=a.length;h<e;)var f=h++,c=c+a[f]*b[f];return c};b.a.j=function(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,.4166666666666667)-.055};b.a.s=function(a){return.04045<a?Math.pow((a+.055)/1.055,2.4):a/12.92};b.a.ea=function(a){return[b.a.j(b.a.f(b.a.g[0],a)),b.a.j(b.a.f(b.a.g[1],a)),b.a.j(b.a.f(b.a.g[2],a))]};b.a.da=function(a){a=[b.a.s(a[0]),b.a.s(a[1]),b.a.s(a[2])];return[b.a.f(b.a.o[0],a),b.a.f(b.a.o[1],a),b.a.f(b.a.o[2],a)]};
b.a.fa=function(a){return a<=b.a.H?a/b.a.i*b.a.m:116*Math.pow(a/b.a.i,.3333333333333333)-16};b.a.X=function(a){return 8>=a?b.a.i*a/b.a.m:b.a.i*Math.pow((a+16)/116,3)};b.a.N=function(a){var d=a[0],c=a[1];a=d+15*c+3*a[2];0!=a?(d=4*d/a,a=9*c/a):a=d=NaN;c=b.a.fa(c);return 0==c?[0,0,0]:[c,13*c*(d-b.a.w),13*c*(a-b.a.A)]};b.a.ca=function(a){var d=a[0];if(0==d)return[0,0,0];var c=a[1]/(13*d)+b.a.w;a=a[2]/(13*d)+b.a.A;d=b.a.X(d);c=0-9*d*c/((c-4)*a-c*a);return[c,d,(9*d-15*a*d-a*c)/(3*a)]};b.a.ba=function(a){var b=
a[0],c=a[1],e=a[2];a=Math.sqrt(c*c+e*e);1E-8>a?c=0:(c=180*Math.atan2(e,c)/3.141592653589793,0>c&&(c=360+c));return[b,a,c]};b.a.$=function(a){var b=a[1],c=a[2]/360*2*Math.PI;return[a[0],Math.cos(c)*b,Math.sin(c)*b]};b.a.W=function(a){var d=a[0],c=a[1];a=a[2];if(99.9999999<a)return[100,0,d];if(1E-8>a)return[0,0,d];c=b.a.u(a,d)/100*c;return[a,c,d]};b.a.Z=function(a){var d=a[0],c=a[1];a=a[2];if(99.9999999<d)return[a,0,100];if(1E-8>d)return[a,0,0];var e=b.a.u(d,a);return[a,c/e*100,d]};b.a.U=function(a){var d=
a[0],c=a[1];a=a[2];if(99.9999999<a)return[100,0,d];if(1E-8>a)return[0,0,d];c=b.a.v(a)/100*c;return[a,c,d]};b.a.Y=function(a){var d=a[0],c=a[1];a=a[2];if(99.9999999<d)return[a,0,100];if(1E-8>d)return[a,0,0];var e=b.a.v(d);return[a,c/e*100,d]};b.a.B=function(a){for(var b="#",c=0,e=a.length;c<e;)var f=c++,b=b+l.P(Math.round(255*a[f])).toLowerCase();return b};b.a.J=function(a){a=a.toUpperCase();return[g.l("0x"+f.substr(a,1,2))/255,g.l("0x"+f.substr(a,3,2))/255,g.l("0x"+f.substr(a,5,2))/255]};b.a.M=function(a){return b.a.ea(b.a.ca(b.a.$(a)))};
b.a.F=function(a){return b.a.ba(b.a.N(b.a.da(a)))};b.a.L=function(a){return b.a.M(b.a.W(a))};b.a.D=function(a){return b.a.Z(b.a.F(a))};b.a.K=function(a){return b.a.M(b.a.U(a))};b.a.C=function(a){return b.a.Y(b.a.F(a))};b.a.V=function(a){return b.a.B(b.a.L(a))};b.a.T=function(a){return b.a.B(b.a.K(a))};b.a.S=function(a){return b.a.D(b.a.J(a))};b.a.R=function(a){return b.a.C(b.a.J(a))};b.a.g=[[3.240969941904521,-1.537383177570093,-.498610760293],[-.96924363628087,1.87596750150772,.041555057407175],
[.055630079696993,-.20397695888897,1.056971514242878]];b.a.o=[[.41239079926595,.35758433938387,.18048078840183],[.21263900587151,.71516867876775,.072192315360733],[.019330818715591,.11919477979462,.95053215224966]];b.a.i=1;b.a.w=.19783000664283;b.a.A=.46831999493879;b.a.m=903.2962962;b.a.H=.0088564516;var e=b.a,e={hsluvToRgb:e.L,rgbToHsluv:e.D,hpluvToRgb:e.K,rgbToHpluv:e.C,hsluvToHex:e.V,hexToHsluv:e.S,hpluvToHex:e.T,hexToHpluv:e.R};"undefined"!==typeof module&&(module.exports=e);"undefined"!==typeof define&&
define(e);"undefined"!==typeof window&&(window.hsluv=e)})();