Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

culori

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

culori - npm Package Compare versions

Comparing version 0.2.39 to 0.2.40

12

build/culori.js

@@ -351,5 +351,5 @@ (function (global, factory) {

return lrgb_to_rgb({
r: x * 3.1338561 - y * 1.6168667 - 0.4906146 * z,
g: x * -0.9787684 + y * 1.9161415 + 0.0334540 * z,
b: x * 0.0719453 - y * 0.2289914 + 1.4052427 * z
r: x * 3.13363711 - y * 1.61712859 - 0.49058412 * z,
g: x * -0.97881806 + y * 1.91629861 + 0.03344362 * z,
b: x * 0.07197263 - y * 0.2290317 + 1.40572334 * z
});

@@ -400,5 +400,5 @@ });

return {
x: 0.4360747 * r + 0.3850649 * g + 0.1430804 * b,
y: 0.2225045 * r + 0.7168786 * g + 0.0606169 * b,
z: 0.0139322 * r + 0.0971045 * g + 0.7141733 * b
x: 0.43613511 * r + 0.38514264 * g + 0.14304411 * b,
y: 0.22252864 * r + 0.7168705 * g + 0.06060527 * b,
z: 0.01392614 * r + 0.09707906 * g + 0.71392803 * b
};

@@ -405,0 +405,0 @@ });

@@ -1,1 +0,1 @@

!function(r,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):r.culori=a()}(this,function(){"use strict";var r=function(r){return(r%=360)<0?r+360:r};function a(a){var e=a.h,n=a.s,t=a.v,o=a.alpha;e=r(e);var i=Math.abs(e/60%2-1),l=void 0;switch(Math.floor(e/60)){case 0:l={r:t,g:t*(1-n*i),b:t*(1-n)};break;case 1:l={r:t*(1-n*i),g:t,b:t*(1-n)};break;case 2:l={r:t*(1-n),g:t,b:t*(1-n*i)};break;case 3:l={r:t*(1-n),g:t*(1-n*i),b:t};break;case 4:l={r:t*(1-n*i),g:t*(1-n),b:t};break;case 5:l={r:t,g:t*(1-n),b:t*(1-n*i)};break;default:l={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return l.mode="rgb",void 0!==o&&(l.alpha=o),l}function e(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o=Math.max(a,e,n),i=Math.min(a,e,n),l={mode:"hsv",s:0===o?0:1-i/o,v:o};return o-i!=0&&(l.h=60*(o===a?(e-n)/(o-i)+6*(e<n):o===e?(n-a)/(o-i)+2:(a-e)/(o-i)+4)),void 0!==t&&(l.alpha=t),l}var n=function(a){var e=a.l,n=a.a,t=a.b,o=a.alpha,i={mode:"lch",l:e,c:Math.sqrt(n*n+t*t),h:r(180*Math.atan2(t,n)/Math.PI)};return void 0!==o&&(i.alpha=o),i},t=function(r){var a=r.l,e=r.c,n=r.h,t=r.alpha,o={mode:"lab",l:a,a:e*Math.cos(n/180*Math.PI),b:e*Math.sin(n/180*Math.PI)};return void 0!==t&&(o.alpha=t),o},o=Math.pow(29,3)/Math.pow(3,3),i=Math.pow(6,3)/Math.pow(29,3),l=function(r){return r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r},h=function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o={mode:"rgb",r:l(a),g:l(e),b:l(n)};return void 0!==t&&(o.alpha=t),o},u=function(r){var a,e,n,t,l=function(r){var a=r.x,e=r.y,n=r.z;return h({r:3.1338561*a-1.6168667*e-.4906146*n,g:-.9787684*a+1.9161415*e+.033454*n,b:.0719453*a-.2289914*e+1.4052427*n})}((e=(a=r).l,n=a.a/500+(e+16)/116,t=(e+16)/116-a.b/200,{x:.9642*(Math.pow(n,3)>i?Math.pow(n,3):(116*n-16)/o),y:1*(e>8?Math.pow((e+16)/116,3):e/o),z:.82521*(Math.pow(t,3)>i?Math.pow(t,3):(116*t-16)/o)}));return l.mode="rgb",void 0!==r.alpha&&(l.alpha=r.alpha),l},s=function(r){return r<.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)},d=function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o={mode:"lrgb",r:s(a),g:s(e),b:s(n)};return void 0!==t&&(o.alpha=t),o},b=Math.pow(29,3)/Math.pow(3,3),g=Math.pow(6,3)/Math.pow(29,3),c=function(r){return r>g?Math.cbrt(r):(b*r+16)/116},p=function(r){var a,e,n,t,o,i,l=(a=function(r){var a=d(r),e=a.r,n=a.g,t=a.b;return{x:.4360747*e+.3850649*n+.1430804*t,y:.2225045*e+.7168786*n+.0606169*t,z:.0139322*e+.0971045*n+.7141733*t}}(r),e=a.x,n=a.y,t=a.z,o=c(e/.9642),{l:116*(i=c(n/1))-16,a:500*(o-i),b:200*(i-c(t/.82521))});return l.mode="lab",void 0!==r.alpha&&(l.alpha=r.alpha),l},v={hsi:{rgb:function(a){var e=a.h,n=a.s,t=a.i,o=a.alpha;e=r(e);var i=Math.abs(e/60%2-1),l=void 0;switch(Math.floor(e/60)){case 0:l={r:t*(1+n*(3/(2-i)-1)),g:t*(1+n*(3*(1-i)/(2-i)-1)),b:t*(1-n)};break;case 1:l={r:t*(1+n*(3*(1-i)/(2-i)-1)),g:t*(1+n*(3/(2-i)-1)),b:t*(1-n)};break;case 2:l={r:t*(1-n),g:t*(1+n*(3/(2-i)-1)),b:t*(1+n*(3*(1-i)/(2-i)-1))};break;case 3:l={r:t*(1-n),g:t*(1+n*(3*(1-i)/(2-i)-1)),b:t*(1+n*(3/(2-i)-1))};break;case 4:l={r:t*(1+n*(3*(1-i)/(2-i)-1)),g:t*(1-n),b:t*(1+n*(3/(2-i)-1))};break;case 5:l={r:t*(1+n*(3/(2-i)-1)),g:t*(1-n),b:t*(1+n*(3*(1-i)/(2-i)-1))};break;default:l={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return l.mode="rgb",void 0!==o&&(l.alpha=o),l}},hsl:{rgb:function(a){var e=a.h,n=a.s,t=a.l,o=a.alpha;e=r(e);var i=t+n*(t<.5?t:1-t),l=i-2*(i-t)*Math.abs(e/60%2-1),h=void 0;switch(Math.floor(e/60)){case 0:h={r:i,g:l,b:2*t-i};break;case 1:h={r:l,g:i,b:2*t-i};break;case 2:h={r:2*t-i,g:i,b:l};break;case 3:h={r:2*t-i,g:l,b:i};break;case 4:h={r:l,g:2*t-i,b:i};break;case 5:h={r:i,g:2*t-i,b:l};break;default:h={r:2*t-i,g:2*t-i,b:2*t-i}}return h.mode="rgb",void 0!==o&&(h.alpha=o),h}},hsv:{rgb:a},hwb:{rgb:function(r){var e=r.h,n=r.w,t=r.b,o=r.alpha;if(n+t>1){var i=n+t;n/=i,t/=i}return a({h:e,s:1===t?1:1-n/(1-t),v:1-t,alpha:o})}},lab:{lch:n,rgb:u},lch:{lab:t,rgb:function(r){return u(t(r))}},rgb:{hsi:function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o=Math.max(a,e,n),i=Math.min(a,e,n),l={mode:"hsi",s:a+e+n===0?0:1-3*i/(a+e+n),i:(a+e+n)/3};return o-i!=0&&(l.h=60*(o===a?(e-n)/(o-i)+6*(e<n):o===e?(n-a)/(o-i)+2:(a-e)/(o-i)+4)),void 0!==t&&(l.alpha=t),l},hsl:function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o=Math.max(a,e,n),i=Math.min(a,e,n),l={mode:"hsl",s:o===i?0:(o-i)/(1-Math.abs(o+i-1)),l:.5*(o+i)};return o-i!=0&&(l.h=60*(o===a?(e-n)/(o-i)+6*(e<n):o===e?(n-a)/(o-i)+2:(a-e)/(o-i)+4)),void 0!==t&&(l.alpha=t),l},hsv:e,hwb:function(r){var a=e(r);if(void 0!==a){var n={mode:"hwb",w:(1-a.s)*a.v,b:1-a.v};return void 0!==a.h&&(n.h=a.h),void 0!==a.alpha&&(n.alpha=a.alpha),n}},lab:p,lch:function(r){return n(p(r))},lrgb:d},lrgb:{rgb:h}},f=function(r,a){return void 0!==r?r.mode===a?r:v[r.mode][a]?v[r.mode][a](r):"rgb"===mode?v[r.mode].rgb(r):v.rgb[a](v[r.mode].rgb(r)):void 0},m=function(r,a){if("number"==typeof r)return 3===a?{mode:"rgb",r:(r>>8&15|r>>4&240)/255,g:(r>>4&15|240&r)/255,b:(15&r|r<<4&240)/255}:4===a?{mode:"rgb",r:(r>>12&15|r>>8&240)/255,g:(r>>8&15|r>>4&240)/255,b:(r>>4&15|240&r)/255,alpha:(15&r|r<<4&240)/255}:6===a?{mode:"rgb",r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255}:8===a?{mode:"rgb",r:(r>>24&255)/255,g:(r>>16&255)/255,b:(r>>8&255)/255,alpha:(255&r)/255}:void 0},w={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},y=function(r){return"string"==typeof r&&m(w[r.toLowerCase()],6)||void 0},k=(/([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)/+"").replace(/^\/|\/$/g,""),M=k+"%",x="(?:"+k+"%|"+k+")",$="(?:"+k+"(deg|grad|rad|turn)|"+k+")",E="\\s*,\\s*",R="\\s+",j=new RegExp("^rgba?\\(\\s*"+k+E+k+E+k+"\\s*(?:,\\s*"+x+"\\s*)?\\)$"),q=new RegExp("^rgba?\\(\\s*"+M+E+M+E+M+"\\s*(?:,\\s*"+x+"\\s*)?\\)$"),O=new RegExp("^rgba?\\(\\s*"+k+R+k+R+k+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),z=new RegExp("^rgba?\\(\\s*"+M+R+M+R+M+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),S=new RegExp("^hsla?\\(\\s*"+$+E+M+E+M+"\\s*(?:,\\s*"+x+"\\s*)?\\)$"),I=new RegExp("^hsla?\\(\\s*"+$+R+M+R+M+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),P=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,H=new RegExp("^hwb\\(\\s*"+$+R+M+R+M+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),N=new RegExp("^lab\\(\\s*"+k+R+k+R+k+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),C=new RegExp("^lch\\(\\s*"+k+R+k+R+$+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),L=new RegExp("^gray\\(\\s*"+k+"()()\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),A=function(r){var a;return(a=r.match(P))?m(parseInt(a[1],16),a[1].length):void 0},B=function(r){var a=void 0,e=void 0;if(a=r.match(j)||r.match(O))e={mode:"rgb",r:a[1]/255,g:a[2]/255,b:a[3]/255};else{if(!(a=r.match(q)||r.match(z)))return;e={mode:"rgb",r:a[1]/100,g:a[2]/100,b:a[3]/100}}return void 0!==a[4]?e.alpha=a[4]/100:void 0!==a[5]&&(e.alpha=+a[5]),e},D=function(r,a){switch(a){case"deg":return+r;case"rad":return r/Math.PI*180;case"grad":return r/10*9;case"turn":return 360*r}},F=function(r){if("string"==typeof r){var a=r.match(S)||r.match(I);if(a){var e={mode:"hsl",h:void 0===a[3]?D(a[1],a[2]):+a[3],s:Math.min(Math.max(0,a[4]/100),1),l:Math.min(Math.max(0,a[5]/100),1)};return void 0!==a[6]?e.alpha=a[6]/100:void 0!==a[7]&&(e.alpha=a[7]/255),e}}},G=function(r){if("string"==typeof r){var a=r.match(H);if(a){var e={mode:"hwb",h:void 0===a[3]?D(a[1],a[2]):+a[3],w:a[4]/100,b:a[5]/100};if(e.w+e.b>1){var n=e.w+e.b;e.w/=n,e.b/=n}return void 0!==a[6]?e.alpha=a[6]/100:void 0!==a[7]&&(e.alpha=a[7]/255),e}}},J=function(r){return A(r)||B(r)||F(r)||y(r)||("transparent"===r?m(0,8):void 0)||G(r)||function(r){var a=void 0,e=void 0;if(a=r.match(N))e={mode:"lab",l:+a[1],a:+a[2],b:+a[3]};else{if(!(a=r.match(L)))return;e={mode:"lab",l:+a[1],a:0,b:0}}return void 0!==a[4]?e.alpha=a[4]/100:void 0!==a[5]&&(e.alpha=+a[5]),e}(r)||function(r){var a=r.match(C);if(a){var e={mode:"lch",l:+a[1],c:Math.max(0,+a[2]),h:void 0===a[5]?D(a[3],a[4]):+a[5]};return void 0!==a[6]?e.alpha=a[6]/100:void 0!==a[7]&&(e.alpha=+a[7]),e}}(r)},K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Q=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},T=function(r,a){return"object"!==(void 0===r?"undefined":K(r))?J(r):void 0===r.mode?Q({},r,{mode:a}):r},U=function(r){return f(T(r,"rgb"),"rgb")},V=function(r,a){return Math.round(r*(a=Math.pow(10,a)))/a};function W(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(void 0!==r)return"number"==typeof r?V(r,a):"string"==typeof r?r:"object"===(void 0===r?"undefined":K(r))?Object.keys(r).reduce(function(a,e){return a[e]=W(r[e]),a},{}):void 0}var X=function(r){return Math.round(255*Math.max(0,Math.min(r,1)))},Y={rgb:["r","g","b","alpha"],hsl:["h","s","l","alpha"],hsv:["h","s","v","alpha"],hsi:["h","s","i","alpha"],lab:["l","a","b","alpha"],lch:["l","c","h","alpha"],hwb:["h","w","b","alpha"],lrgb:["r","g","b","alpha"]},Z=function(r,a){var e=Y[r.mode].reduce(function(e,n){var t=a(n,r[n]);return void 0!==t&&(e[n]=t),e},{});return e.mode=r.mode,e},_=function(r,a,e){return r+e*(a-r)},rr=function(r){return U(r)},ar=Object.freeze({hsl:function(r){return f(T(r,"hsl"),"hsl")},hsv:function(r){return f(T(r,"hsv"),"hsv")},hsi:function(r){return f(T(r,"hsi"),"hsi")},hwb:function(r){return f(T(r,"hwb"),"hwb")},rgb:U,lab:function(r){return f(T(r,"lab"),"lab")},lch:function(r){return f(T(r,"lch"),"lch")},lrgb:function(r){return f(T(r,"lrgb"),"lrgb")},css:function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgb",e=U(r),n=X(e.r),t=X(e.g),o=X(e.b);return"hex"===a?"#"+(1<<24|n<<16|t<<8|o).toString(16).slice(1):"rgb"===a?void 0===e.alpha||1===e.alpha?"rgb("+n+", "+t+", "+o+")":"rgba("+n+", "+t+", "+o+", "+W(e.alpha,2)+")":void 0},convert:f,prepare:T,round:W,parse:J,parseNumber:m,parseNamed:y,parseHex:A,parseRgb:B,parseHsl:F,parseHwb:G,named:w,map:Z,interpolate:function(a){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgb";if(!(a.length<2)){var n=a.map(function(r){return f(T(r,e),e)});return function(a){if(1===(a=Math.min(Math.max(0,a),1)))return Object.assign({},n[n.length-1]);var t=a*(n.length-1),o=Math.floor(t),i=n[o],l=n[o+1],h=t-o;return Z({mode:e},function(a){return("h"===a?function(a,e,n){return void 0!==a&&void 0!==e?(a=r(a),e=r(e),Math.abs(e-a)>180?r(_(a,e-360*Math.sign(e-a),n)):_(a,e,n)):void 0===a?e:a}:"alpha"===a?function(r,a,e){if(!(void 0===r&&void 0===a||void 0===r&&0===e||void 0===a&&1===e))return _(void 0===r?1:r,void 0===a?1:a,e)}:function(r,a,e){return void 0!==r&&void 0!==a?_(r,a,e):void 0===r?a:r})(i[a],l[a],h)})}}},swatches:function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(a<2)return a<1?[]:[r(.5)];for(var e=[],n=0;n<a;n++)e.push(r(n/(a-1)));return e},default:rr});return Object.assign(rr,ar),rr});
!function(r,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):r.culori=a()}(this,function(){"use strict";var r=function(r){return(r%=360)<0?r+360:r};function a(a){var e=a.h,n=a.s,t=a.v,o=a.alpha;e=r(e);var i=Math.abs(e/60%2-1),l=void 0;switch(Math.floor(e/60)){case 0:l={r:t,g:t*(1-n*i),b:t*(1-n)};break;case 1:l={r:t*(1-n*i),g:t,b:t*(1-n)};break;case 2:l={r:t*(1-n),g:t,b:t*(1-n*i)};break;case 3:l={r:t*(1-n),g:t*(1-n*i),b:t};break;case 4:l={r:t*(1-n*i),g:t*(1-n),b:t};break;case 5:l={r:t,g:t*(1-n),b:t*(1-n*i)};break;default:l={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return l.mode="rgb",void 0!==o&&(l.alpha=o),l}function e(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o=Math.max(a,e,n),i=Math.min(a,e,n),l={mode:"hsv",s:0===o?0:1-i/o,v:o};return o-i!=0&&(l.h=60*(o===a?(e-n)/(o-i)+6*(e<n):o===e?(n-a)/(o-i)+2:(a-e)/(o-i)+4)),void 0!==t&&(l.alpha=t),l}var n=function(a){var e=a.l,n=a.a,t=a.b,o=a.alpha,i={mode:"lch",l:e,c:Math.sqrt(n*n+t*t),h:r(180*Math.atan2(t,n)/Math.PI)};return void 0!==o&&(i.alpha=o),i},t=function(r){var a=r.l,e=r.c,n=r.h,t=r.alpha,o={mode:"lab",l:a,a:e*Math.cos(n/180*Math.PI),b:e*Math.sin(n/180*Math.PI)};return void 0!==t&&(o.alpha=t),o},o=Math.pow(29,3)/Math.pow(3,3),i=Math.pow(6,3)/Math.pow(29,3),l=function(r){return r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r},h=function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o={mode:"rgb",r:l(a),g:l(e),b:l(n)};return void 0!==t&&(o.alpha=t),o},u=function(r){var a,e,n,t,l=function(r){var a=r.x,e=r.y,n=r.z;return h({r:3.13363711*a-1.61712859*e-.49058412*n,g:-.97881806*a+1.91629861*e+.03344362*n,b:.07197263*a-.2290317*e+1.40572334*n})}((e=(a=r).l,n=a.a/500+(e+16)/116,t=(e+16)/116-a.b/200,{x:.9642*(Math.pow(n,3)>i?Math.pow(n,3):(116*n-16)/o),y:1*(e>8?Math.pow((e+16)/116,3):e/o),z:.82521*(Math.pow(t,3)>i?Math.pow(t,3):(116*t-16)/o)}));return l.mode="rgb",void 0!==r.alpha&&(l.alpha=r.alpha),l},s=function(r){return r<.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)},d=function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o={mode:"lrgb",r:s(a),g:s(e),b:s(n)};return void 0!==t&&(o.alpha=t),o},b=Math.pow(29,3)/Math.pow(3,3),g=Math.pow(6,3)/Math.pow(29,3),c=function(r){return r>g?Math.cbrt(r):(b*r+16)/116},p=function(r){var a,e,n,t,o,i,l=(a=function(r){var a=d(r),e=a.r,n=a.g,t=a.b;return{x:.43613511*e+.38514264*n+.14304411*t,y:.22252864*e+.7168705*n+.06060527*t,z:.01392614*e+.09707906*n+.71392803*t}}(r),e=a.x,n=a.y,t=a.z,o=c(e/.9642),{l:116*(i=c(n/1))-16,a:500*(o-i),b:200*(i-c(t/.82521))});return l.mode="lab",void 0!==r.alpha&&(l.alpha=r.alpha),l},v={hsi:{rgb:function(a){var e=a.h,n=a.s,t=a.i,o=a.alpha;e=r(e);var i=Math.abs(e/60%2-1),l=void 0;switch(Math.floor(e/60)){case 0:l={r:t*(1+n*(3/(2-i)-1)),g:t*(1+n*(3*(1-i)/(2-i)-1)),b:t*(1-n)};break;case 1:l={r:t*(1+n*(3*(1-i)/(2-i)-1)),g:t*(1+n*(3/(2-i)-1)),b:t*(1-n)};break;case 2:l={r:t*(1-n),g:t*(1+n*(3/(2-i)-1)),b:t*(1+n*(3*(1-i)/(2-i)-1))};break;case 3:l={r:t*(1-n),g:t*(1+n*(3*(1-i)/(2-i)-1)),b:t*(1+n*(3/(2-i)-1))};break;case 4:l={r:t*(1+n*(3*(1-i)/(2-i)-1)),g:t*(1-n),b:t*(1+n*(3/(2-i)-1))};break;case 5:l={r:t*(1+n*(3/(2-i)-1)),g:t*(1-n),b:t*(1+n*(3*(1-i)/(2-i)-1))};break;default:l={r:t*(1-n),g:t*(1-n),b:t*(1-n)}}return l.mode="rgb",void 0!==o&&(l.alpha=o),l}},hsl:{rgb:function(a){var e=a.h,n=a.s,t=a.l,o=a.alpha;e=r(e);var i=t+n*(t<.5?t:1-t),l=i-2*(i-t)*Math.abs(e/60%2-1),h=void 0;switch(Math.floor(e/60)){case 0:h={r:i,g:l,b:2*t-i};break;case 1:h={r:l,g:i,b:2*t-i};break;case 2:h={r:2*t-i,g:i,b:l};break;case 3:h={r:2*t-i,g:l,b:i};break;case 4:h={r:l,g:2*t-i,b:i};break;case 5:h={r:i,g:2*t-i,b:l};break;default:h={r:2*t-i,g:2*t-i,b:2*t-i}}return h.mode="rgb",void 0!==o&&(h.alpha=o),h}},hsv:{rgb:a},hwb:{rgb:function(r){var e=r.h,n=r.w,t=r.b,o=r.alpha;if(n+t>1){var i=n+t;n/=i,t/=i}return a({h:e,s:1===t?1:1-n/(1-t),v:1-t,alpha:o})}},lab:{lch:n,rgb:u},lch:{lab:t,rgb:function(r){return u(t(r))}},rgb:{hsi:function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o=Math.max(a,e,n),i=Math.min(a,e,n),l={mode:"hsi",s:a+e+n===0?0:1-3*i/(a+e+n),i:(a+e+n)/3};return o-i!=0&&(l.h=60*(o===a?(e-n)/(o-i)+6*(e<n):o===e?(n-a)/(o-i)+2:(a-e)/(o-i)+4)),void 0!==t&&(l.alpha=t),l},hsl:function(r){var a=r.r,e=r.g,n=r.b,t=r.alpha,o=Math.max(a,e,n),i=Math.min(a,e,n),l={mode:"hsl",s:o===i?0:(o-i)/(1-Math.abs(o+i-1)),l:.5*(o+i)};return o-i!=0&&(l.h=60*(o===a?(e-n)/(o-i)+6*(e<n):o===e?(n-a)/(o-i)+2:(a-e)/(o-i)+4)),void 0!==t&&(l.alpha=t),l},hsv:e,hwb:function(r){var a=e(r);if(void 0!==a){var n={mode:"hwb",w:(1-a.s)*a.v,b:1-a.v};return void 0!==a.h&&(n.h=a.h),void 0!==a.alpha&&(n.alpha=a.alpha),n}},lab:p,lch:function(r){return n(p(r))},lrgb:d},lrgb:{rgb:h}},f=function(r,a){return void 0!==r?r.mode===a?r:v[r.mode][a]?v[r.mode][a](r):"rgb"===mode?v[r.mode].rgb(r):v.rgb[a](v[r.mode].rgb(r)):void 0},m=function(r,a){if("number"==typeof r)return 3===a?{mode:"rgb",r:(r>>8&15|r>>4&240)/255,g:(r>>4&15|240&r)/255,b:(15&r|r<<4&240)/255}:4===a?{mode:"rgb",r:(r>>12&15|r>>8&240)/255,g:(r>>8&15|r>>4&240)/255,b:(r>>4&15|240&r)/255,alpha:(15&r|r<<4&240)/255}:6===a?{mode:"rgb",r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255}:8===a?{mode:"rgb",r:(r>>24&255)/255,g:(r>>16&255)/255,b:(r>>8&255)/255,alpha:(255&r)/255}:void 0},w={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},y=function(r){return"string"==typeof r&&m(w[r.toLowerCase()],6)||void 0},k=(/([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)/+"").replace(/^\/|\/$/g,""),M=k+"%",x="(?:"+k+"%|"+k+")",$="(?:"+k+"(deg|grad|rad|turn)|"+k+")",E="\\s*,\\s*",R="\\s+",j=new RegExp("^rgba?\\(\\s*"+k+E+k+E+k+"\\s*(?:,\\s*"+x+"\\s*)?\\)$"),q=new RegExp("^rgba?\\(\\s*"+M+E+M+E+M+"\\s*(?:,\\s*"+x+"\\s*)?\\)$"),O=new RegExp("^rgba?\\(\\s*"+k+R+k+R+k+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),z=new RegExp("^rgba?\\(\\s*"+M+R+M+R+M+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),S=new RegExp("^hsla?\\(\\s*"+$+E+M+E+M+"\\s*(?:,\\s*"+x+"\\s*)?\\)$"),I=new RegExp("^hsla?\\(\\s*"+$+R+M+R+M+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),P=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,H=new RegExp("^hwb\\(\\s*"+$+R+M+R+M+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),N=new RegExp("^lab\\(\\s*"+k+R+k+R+k+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),C=new RegExp("^lch\\(\\s*"+k+R+k+R+$+"\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),L=new RegExp("^gray\\(\\s*"+k+"()()\\s*(?:\\/\\s*"+x+"\\s*)?\\)$"),A=function(r){var a;return(a=r.match(P))?m(parseInt(a[1],16),a[1].length):void 0},B=function(r){var a=void 0,e=void 0;if(a=r.match(j)||r.match(O))e={mode:"rgb",r:a[1]/255,g:a[2]/255,b:a[3]/255};else{if(!(a=r.match(q)||r.match(z)))return;e={mode:"rgb",r:a[1]/100,g:a[2]/100,b:a[3]/100}}return void 0!==a[4]?e.alpha=a[4]/100:void 0!==a[5]&&(e.alpha=+a[5]),e},D=function(r,a){switch(a){case"deg":return+r;case"rad":return r/Math.PI*180;case"grad":return r/10*9;case"turn":return 360*r}},F=function(r){if("string"==typeof r){var a=r.match(S)||r.match(I);if(a){var e={mode:"hsl",h:void 0===a[3]?D(a[1],a[2]):+a[3],s:Math.min(Math.max(0,a[4]/100),1),l:Math.min(Math.max(0,a[5]/100),1)};return void 0!==a[6]?e.alpha=a[6]/100:void 0!==a[7]&&(e.alpha=a[7]/255),e}}},G=function(r){if("string"==typeof r){var a=r.match(H);if(a){var e={mode:"hwb",h:void 0===a[3]?D(a[1],a[2]):+a[3],w:a[4]/100,b:a[5]/100};if(e.w+e.b>1){var n=e.w+e.b;e.w/=n,e.b/=n}return void 0!==a[6]?e.alpha=a[6]/100:void 0!==a[7]&&(e.alpha=a[7]/255),e}}},J=function(r){return A(r)||B(r)||F(r)||y(r)||("transparent"===r?m(0,8):void 0)||G(r)||function(r){var a=void 0,e=void 0;if(a=r.match(N))e={mode:"lab",l:+a[1],a:+a[2],b:+a[3]};else{if(!(a=r.match(L)))return;e={mode:"lab",l:+a[1],a:0,b:0}}return void 0!==a[4]?e.alpha=a[4]/100:void 0!==a[5]&&(e.alpha=+a[5]),e}(r)||function(r){var a=r.match(C);if(a){var e={mode:"lch",l:+a[1],c:Math.max(0,+a[2]),h:void 0===a[5]?D(a[3],a[4]):+a[5]};return void 0!==a[6]?e.alpha=a[6]/100:void 0!==a[7]&&(e.alpha=+a[7]),e}}(r)},K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Q=Object.assign||function(r){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},T=function(r,a){return"object"!==(void 0===r?"undefined":K(r))?J(r):void 0===r.mode?Q({},r,{mode:a}):r},U=function(r){return f(T(r,"rgb"),"rgb")},V=function(r,a){return Math.round(r*(a=Math.pow(10,a)))/a};function W(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(void 0!==r)return"number"==typeof r?V(r,a):"string"==typeof r?r:"object"===(void 0===r?"undefined":K(r))?Object.keys(r).reduce(function(a,e){return a[e]=W(r[e]),a},{}):void 0}var X=function(r){return Math.round(255*Math.max(0,Math.min(r,1)))},Y={rgb:["r","g","b","alpha"],hsl:["h","s","l","alpha"],hsv:["h","s","v","alpha"],hsi:["h","s","i","alpha"],lab:["l","a","b","alpha"],lch:["l","c","h","alpha"],hwb:["h","w","b","alpha"],lrgb:["r","g","b","alpha"]},Z=function(r,a){var e=Y[r.mode].reduce(function(e,n){var t=a(n,r[n]);return void 0!==t&&(e[n]=t),e},{});return e.mode=r.mode,e},_=function(r,a,e){return r+e*(a-r)},rr=function(r){return U(r)},ar=Object.freeze({hsl:function(r){return f(T(r,"hsl"),"hsl")},hsv:function(r){return f(T(r,"hsv"),"hsv")},hsi:function(r){return f(T(r,"hsi"),"hsi")},hwb:function(r){return f(T(r,"hwb"),"hwb")},rgb:U,lab:function(r){return f(T(r,"lab"),"lab")},lch:function(r){return f(T(r,"lch"),"lch")},lrgb:function(r){return f(T(r,"lrgb"),"lrgb")},css:function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgb",e=U(r),n=X(e.r),t=X(e.g),o=X(e.b);return"hex"===a?"#"+(1<<24|n<<16|t<<8|o).toString(16).slice(1):"rgb"===a?void 0===e.alpha||1===e.alpha?"rgb("+n+", "+t+", "+o+")":"rgba("+n+", "+t+", "+o+", "+W(e.alpha,2)+")":void 0},convert:f,prepare:T,round:W,parse:J,parseNumber:m,parseNamed:y,parseHex:A,parseRgb:B,parseHsl:F,parseHwb:G,named:w,map:Z,interpolate:function(a){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgb";if(!(a.length<2)){var n=a.map(function(r){return f(T(r,e),e)});return function(a){if(1===(a=Math.min(Math.max(0,a),1)))return Object.assign({},n[n.length-1]);var t=a*(n.length-1),o=Math.floor(t),i=n[o],l=n[o+1],h=t-o;return Z({mode:e},function(a){return("h"===a?function(a,e,n){return void 0!==a&&void 0!==e?(a=r(a),e=r(e),Math.abs(e-a)>180?r(_(a,e-360*Math.sign(e-a),n)):_(a,e,n)):void 0===a?e:a}:"alpha"===a?function(r,a,e){if(!(void 0===r&&void 0===a||void 0===r&&0===e||void 0===a&&1===e))return _(void 0===r?1:r,void 0===a?1:a,e)}:function(r,a,e){return void 0!==r&&void 0!==a?_(r,a,e):void 0===r?a:r})(i[a],l[a],h)})}}},swatches:function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(a<2)return a<1?[]:[r(.5)];for(var e=[],n=0;n<a;n++)e.push(r(n/(a-1)));return e},default:rr});return Object.assign(rr,ar),rr});

@@ -345,5 +345,5 @@ var normalizeHue = (function (hue) {

return lrgb_to_rgb({
r: x * 3.1338561 - y * 1.6168667 - 0.4906146 * z,
g: x * -0.9787684 + y * 1.9161415 + 0.0334540 * z,
b: x * 0.0719453 - y * 0.2289914 + 1.4052427 * z
r: x * 3.13363711 - y * 1.61712859 - 0.49058412 * z,
g: x * -0.97881806 + y * 1.91629861 + 0.03344362 * z,
b: x * 0.07197263 - y * 0.2290317 + 1.40572334 * z
});

@@ -394,5 +394,5 @@ });

return {
x: 0.4360747 * r + 0.3850649 * g + 0.1430804 * b,
y: 0.2225045 * r + 0.7168786 * g + 0.0606169 * b,
z: 0.0139322 * r + 0.0971045 * g + 0.7141733 * b
x: 0.43613511 * r + 0.38514264 * g + 0.14304411 * b,
y: 0.22252864 * r + 0.7168705 * g + 0.06060527 * b,
z: 0.01392614 * r + 0.09707906 * g + 0.71392803 * b
};

@@ -399,0 +399,0 @@ });

{
"name": "culori",
"version": "0.2.39",
"version": "0.2.40",
"main": "build/culori.js",

@@ -5,0 +5,0 @@ "module": "build/index.js",

@@ -14,6 +14,6 @@ /*

return {
x: 0.4360747 * r + 0.3850649 * g + 0.1430804 * b,
y: 0.2225045 * r + 0.7168786 * g + 0.0606169 * b,
z: 0.0139322 * r + 0.0971045 * g + 0.7141733 * b
x: 0.43613511 * r + 0.38514264 * g + 0.14304411 * b,
y: 0.22252864 * r + 0.7168705 * g + 0.06060527 * b,
z: 0.01392614 * r + 0.09707906 * g + 0.71392803 * b
};
}

@@ -12,5 +12,5 @@ /*

export default ({ x, y, z }) => lrgb_to_rgb({
r: x * 3.1338561 - y * 1.6168667 - 0.4906146 * z,
g: x * -0.9787684 + y * 1.9161415 + 0.0334540 * z,
b: x * 0.0719453 - y * 0.2289914 + 1.4052427 * z
r: x * 3.13363711 - y * 1.61712859 - 0.49058412 * z,
g: x * -0.97881806 + y * 1.91629861 + 0.03344362 * z,
b: x * 0.07197263 - y * 0.2290317 + 1.40572334 * z
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc