diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6d020de --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2012-2022 Alexei Boronine +Copyright (c) 2016 Florian Dormont + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..100ec4f --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# HSLuv - Human-friendly HSL + +This code originally developed in [main project repo](https://github.com/hsluv/hsluv). + +## Changelog + +### 0.0.1 + +- Initial release under the name HSLuv. Old releases can be found [here](https://www.npmjs.com/package/husl). diff --git a/hsluv-0.0.1.min.js b/hsluv-0.0.1.min.js new file mode 100644 index 0000000..e8a07dc --- /dev/null +++ b/hsluv-0.0.1.min.js @@ -0,0 +1,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(0b.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=a?12.92*a:1.055*Math.pow(a,.4166666666666667)-.055};b.a.s=function(a){return.04045=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.9999999a)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.9999999d)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.9999999a)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.9999999d)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