Socket
Socket
Sign inDemoInstall

colord

Package Overview
Dependencies
0
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.2.1

5

CHANGELOG.md

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

### 1.2.1
- Fix: Do not treat 7-digit hex as a valid color ❤️ @subzey
- Parser update: Turn NaN input values into valid numbers ❤️ @subzey
### 1.2.0

@@ -2,0 +7,0 @@

1

helpers.d.ts

@@ -8,3 +8,4 @@ export declare const isPresent: (value: unknown) => boolean;

* is 2 times shorter then `Math.min(Math.max(a,b),c)`
* NaN is clamped to the lower bound
*/
export declare const clamp: (number: number, min?: number, max?: number) => number;

2

index.js

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

Object.defineProperty(exports,"__esModule",{value:!0});var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},t=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r<t?t:r},e=function(r){return{r:n(r.r,0,255),g:n(r.g,0,255),b:n(r.b,0,255),a:n(r.a)}},u=function(r){return{r:t(r.r),g:t(r.g),b:t(r.b),a:t(r.a,2)}},o=/^\s*#?([0-9A-F]{3,4}){1,2}\s*$/i,a=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},i=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,o=Math.max(t,n,e),a=o-Math.min(t,n,e),i=a?o===t?(n-e)/a:o===n?2+(e-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:o?a/o*100:0,v:o/255*100,a:u}},s=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var o=Math.floor(t),a=e*(1-n),i=e*(1-(t-o)*n),s=e*(1-(1-t+o)*n),b=o%6;return{r:255*[e,i,a,a,s,e][b],g:255*[s,e,e,i,a,a][b],b:255*[a,a,s,e,e,i][b],a:u}},b=function(r){return{h:n(r.h,0,360),s:n(r.s,0,100),l:n(r.l,0,100),a:n(r.a)}},h=function(r){return{h:t(r.h),s:t(r.s),l:t(r.l),a:t(r.a,2)}},f=function(r){return s((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},g=function(r){return{h:(t=i(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},p=/hsla?\(?s*(-?\d+\.?\d*),?\s*(-?\d+\.?\d*)%?,?\s*(-?\d+\.?\d*)%?,?\s*(-?\d*\.?\d+)?s*\)?/i,c=/rgba?\(?\s*(-?\d+),?\s*(-?\d+),?\s*(-?\d+),?\s*(-?\d*\.?\d+)?\s*\)?/i,l={string:[function(r){return o.test(r)?(r=r.replace("#","").trim()).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?parseInt(r[3]+r[3],16)/255:1}:{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?parseInt(r.substr(6,2),16)/255:1}:null},function(r){var t=c.exec(r);return t?e({r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:void 0===t[4]?1:Number(t[4])}):null},function(r){var t=p.exec(r);if(!t)return null;var n=b({h:Number(t[1]),s:Number(t[2]),l:Number(t[3]),a:void 0===t[4]?1:Number(t[4])});return f(n)}],object:[function(t){var n=t.r,u=t.g,o=t.b,a=t.a,i=void 0===a?1:a;return r(n)&&r(u)&&r(o)?e({r:Number(n),g:Number(u),b:Number(o),a:Number(i)}):null},function(t){var n=t.h,e=t.s,u=t.l,o=t.a,a=void 0===o?1:o;if(!r(n)||!r(e)||!r(u))return null;var i=b({h:Number(n),s:Number(e),l:Number(u),a:Number(a)});return f(i)},function(t){var e=t.h,u=t.s,o=t.v,a=t.a,i=void 0===a?1:a;if(!r(e)||!r(u)||!r(o))return null;var b=function(r){return{h:n(r.h,0,360),s:n(r.s,0,100),v:n(r.v,0,100),a:n(r.a)}}({h:Number(e),s:Number(u),v:Number(o),a:Number(i)});return s(b)}]},v=function(r,t){for(var n=0;n<t.length;n++){var e=t[n](r);if(e)return e}return null},d=function(r,t){var e=g(r);return{h:e.h,s:n(e.s+100*t,0,100),l:e.l,a:e.a}},m=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},y=function(r,t){var e=g(r);return{h:e.h,s:e.s,l:n(e.l+100*t,0,100),a:e.a}},N=function(){function r(r){this.parsed=function(r){return"string"==typeof r?v(r,l.string):"object"==typeof r&&null!==r?v(r,l.object):null}(r),this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return t(m(this.rgba),2)},r.prototype.isDark=function(){return m(this.rgba)<.5},r.prototype.isLight=function(){return m(this.rgba)>=.5},r.prototype.toHex=function(){return r=u(this.rgba),n=r.r,e=r.g,o=r.b,s=(i=r.a)<1?a(t(255*i)):"","#"+a(n)+a(e)+a(o)+s;var r,n,e,o,i,s},r.prototype.toRgb=function(){return u(this.rgba)},r.prototype.toRgbString=function(){return r=u(this.rgba),t=r.r,n=r.g,e=r.b,(o=r.a)<1?"rgba("+t+", "+n+", "+e+", "+o+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,o},r.prototype.toHsl=function(){return h(g(this.rgba))},r.prototype.toHslString=function(){return r=h(g(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=i(this.rgba),{h:t(r.h),s:t(r.s),v:t(r.v),a:t(r.a,2)};var r},r.prototype.invert=function(){return x({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),x(d(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),x(d(this.rgba,-r))},r.prototype.grayscale=function(){return x(d(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),x(y(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),x(y(this.rgba,-r))},r.prototype.alpha=function(r){return"number"==typeof r?x({r:(n=this.rgba).r,g:n.g,b:n.b,a:r}):t(this.rgba.a,2);var n},r}(),x=function(r){return r instanceof N?r:new N(r)},I=[];exports.Colord=N,exports.colord=x,exports.extend=function(r){r.forEach(function(r){I.indexOf(r)<0&&(r(N,l),I.push(r))})};
Object.defineProperty(exports,"__esModule",{value:!0});var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},t=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},e=function(r){return{r:n(r.r,0,255),g:n(r.g,0,255),b:n(r.b,0,255),a:n(r.a)}},u=function(r){return{r:t(r.r),g:t(r.g),b:t(r.b),a:t(r.a,2)}},o=/^\s*#?([0-9a-f]{3,8})\s*$/i,a=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},i=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,o=Math.max(t,n,e),a=o-Math.min(t,n,e),i=a?o===t?(n-e)/a:o===n?2+(e-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:o?a/o*100:0,v:o/255*100,a:u}},s=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var o=Math.floor(t),a=e*(1-n),i=e*(1-(t-o)*n),s=e*(1-(1-t+o)*n),b=o%6;return{r:255*[e,i,a,a,s,e][b],g:255*[s,e,e,i,a,a][b],b:255*[a,a,s,e,e,i][b],a:u}},b=function(r){return{h:n(r.h,0,360),s:n(r.s,0,100),l:n(r.l,0,100),a:n(r.a)}},h=function(r){return{h:t(r.h),s:t(r.s),l:t(r.l),a:t(r.a,2)}},f=function(r){return s((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},g=function(r){return{h:(t=i(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/hsla?\(?s*(-?\d+\.?\d*),?\s*(-?\d+\.?\d*)%?,?\s*(-?\d+\.?\d*)%?,?\s*(-?\d*\.?\d+)?s*\)?/i,p=/rgba?\(?\s*(-?\d+),?\s*(-?\d+),?\s*(-?\d+),?\s*(-?\d*\.?\d+)?\s*\)?/i,c={string:[function(r){var t=o.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?parseInt(r[3]+r[3],16)/255:1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?parseInt(r.substr(6,2),16)/255:1}:null:null},function(r){var t=p.exec(r);return t?e({r:Number(t[1]),g:Number(t[2]),b:Number(t[3]),a:void 0===t[4]?1:Number(t[4])}):null},function(r){var t=l.exec(r);if(!t)return null;var n=b({h:Number(t[1]),s:Number(t[2]),l:Number(t[3]),a:void 0===t[4]?1:Number(t[4])});return f(n)}],object:[function(t){var n=t.r,u=t.g,o=t.b,a=t.a,i=void 0===a?1:a;return r(n)&&r(u)&&r(o)?e({r:Number(n),g:Number(u),b:Number(o),a:Number(i)}):null},function(t){var n=t.h,e=t.s,u=t.l,o=t.a,a=void 0===o?1:o;if(!r(n)||!r(e)||!r(u))return null;var i=b({h:Number(n),s:Number(e),l:Number(u),a:Number(a)});return f(i)},function(t){var e=t.h,u=t.s,o=t.v,a=t.a,i=void 0===a?1:a;if(!r(e)||!r(u)||!r(o))return null;var b=function(r){return{h:n(r.h,0,360),s:n(r.s,0,100),v:n(r.v,0,100),a:n(r.a)}}({h:Number(e),s:Number(u),v:Number(o),a:Number(i)});return s(b)}]},v=function(r,t){for(var n=0;n<t.length;n++){var e=t[n](r);if(e)return e}return null},d=function(r,t){var e=g(r);return{h:e.h,s:n(e.s+100*t,0,100),l:e.l,a:e.a}},m=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},y=function(r,t){var e=g(r);return{h:e.h,s:e.s,l:n(e.l+100*t,0,100),a:e.a}},N=function(){function r(r){this.parsed=function(r){return"string"==typeof r?v(r,c.string):"object"==typeof r&&null!==r?v(r,c.object):null}(r),this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return t(m(this.rgba),2)},r.prototype.isDark=function(){return m(this.rgba)<.5},r.prototype.isLight=function(){return m(this.rgba)>=.5},r.prototype.toHex=function(){return r=u(this.rgba),n=r.r,e=r.g,o=r.b,s=(i=r.a)<1?a(t(255*i)):"","#"+a(n)+a(e)+a(o)+s;var r,n,e,o,i,s},r.prototype.toRgb=function(){return u(this.rgba)},r.prototype.toRgbString=function(){return r=u(this.rgba),t=r.r,n=r.g,e=r.b,(o=r.a)<1?"rgba("+t+", "+n+", "+e+", "+o+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,o},r.prototype.toHsl=function(){return h(g(this.rgba))},r.prototype.toHslString=function(){return r=h(g(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=i(this.rgba),{h:t(r.h),s:t(r.s),v:t(r.v),a:t(r.a,2)};var r},r.prototype.invert=function(){return x({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),x(d(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),x(d(this.rgba,-r))},r.prototype.grayscale=function(){return x(d(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),x(y(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),x(y(this.rgba,-r))},r.prototype.alpha=function(r){return"number"==typeof r?x({r:(n=this.rgba).r,g:n.g,b:n.b,a:r}):t(this.rgba.a,2);var n},r}(),x=function(r){return r instanceof N?r:new N(r)},I=[];exports.Colord=N,exports.colord=x,exports.extend=function(r){r.forEach(function(r){I.indexOf(r)<0&&(r(N,c),I.push(r))})};
{
"name": "colord",
"version": "1.2.0",
"version": "1.2.1",
"description": "👑 A tiny yet powerful tool for high-performance color manipulations and conversions",

@@ -5,0 +5,0 @@ "keywords": [

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

var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r<n?n:r},a=function(r){return{h:function(r){var n=r.r,t=r.g,a=r.b,u=r.a,o=Math.max(n,t,a),e=o-Math.min(n,t,a),b=e?o===n?(t-a)/e:o===t?2+(a-n)/e:4+(n-t)/e:0;return{h:60*(b<0?b+6:b),s:o?e/o*100:0,v:o/255*100,a:u}}(r).h,w:Math.min(r.r,r.g,r.b)/255*100,b:100-Math.max(r.r,r.g,r.b)/255*100,a:r.a}},u=function(r){return function(r){var n=r.h,t=r.s,a=r.v,u=r.a;n=n/360*6,t/=100,a/=100;var o=Math.floor(n),e=a*(1-t),b=a*(1-(n-o)*t),h=a*(1-(1-n+o)*t),i=o%6;return{r:255*[a,b,e,e,h,a][i],g:255*[h,a,a,b,e,e][i],b:255*[e,e,h,a,a,b][i],a:u}}({h:r.h,s:100===r.b?0:100-r.w/(100-r.b)*100,v:100-r.b,a:r.a})},o=function(n){var a=n.h,o=n.w,e=n.b,b=n.a,h=void 0===b?1:b;if(!r(a)||!r(o)||!r(e))return null;var i=function(r){return{h:t(r.h,0,360),w:t(r.w,0,100),b:t(r.b,0,100),a:t(r.a)}}({h:Number(a),w:Number(o),b:Number(e),a:Number(h)});return u(i)};module.exports=function(r,t){r.prototype.toHwb=function(){return r=a(this.rgba),{h:n(r.h),w:n(r.w),b:n(r.b),a:n(r.a,2)};var r},t.object.push(o)};
var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},a=function(r){return{h:function(r){var n=r.r,t=r.g,a=r.b,u=r.a,o=Math.max(n,t,a),e=o-Math.min(n,t,a),b=e?o===n?(t-a)/e:o===t?2+(a-n)/e:4+(n-t)/e:0;return{h:60*(b<0?b+6:b),s:o?e/o*100:0,v:o/255*100,a:u}}(r).h,w:Math.min(r.r,r.g,r.b)/255*100,b:100-Math.max(r.r,r.g,r.b)/255*100,a:r.a}},u=function(r){return function(r){var n=r.h,t=r.s,a=r.v,u=r.a;n=n/360*6,t/=100,a/=100;var o=Math.floor(n),e=a*(1-t),b=a*(1-(n-o)*t),h=a*(1-(1-n+o)*t),i=o%6;return{r:255*[a,b,e,e,h,a][i],g:255*[h,a,a,b,e,e][i],b:255*[e,e,h,a,a,b][i],a:u}}({h:r.h,s:100===r.b?0:100-r.w/(100-r.b)*100,v:100-r.b,a:r.a})},o=function(n){var a=n.h,o=n.w,e=n.b,b=n.a,h=void 0===b?1:b;if(!r(a)||!r(o)||!r(e))return null;var i=function(r){return{h:t(r.h,0,360),w:t(r.w,0,100),b:t(r.b,0,100),a:t(r.a)}}({h:Number(a),w:Number(o),b:Number(e),a:Number(h)});return u(i)};module.exports=function(r,t){r.prototype.toHwb=function(){return r=a(this.rgba),{h:n(r.h),w:n(r.w),b:n(r.b),a:n(r.a,2)};var r},t.object.push(o)};

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

var a=function(a){return"string"==typeof a?a.length>0:"number"==typeof a},t=function(a,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*a)/r},r=function(a,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),a>r?r:a<t?t:a},n=function(a){var t=a/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},o=function(a){return 255*(a>.0031308?1.055*Math.pow(a,1/2.4)-.055:12.92*a)},u=function(a){var t,n=a.x/100,u=a.y/100,e=a.z/100;return t={r:o(3.2404542*n-1.5371385*u-.4985314*e),g:o(-.969266*n+1.8760108*u+.041556*e),b:o(.0556434*n-.2040259*u+1.0572252*e),a:a.a},{r:r(t.r,0,255),g:r(t.g,0,255),b:r(t.b,0,255),a:r(t.a)}},e=function(a){var t,o=n(a.r),u=n(a.g),e=n(a.b);return{x:r((t={x:100*(.4124564*o+.3575761*u+.1804375*e),y:100*(.2126729*o+.7151522*u+.072175*e),z:100*(.0193339*o+.119192*u+.9503041*e),a:a.a}).x,0,95.047),y:r(t.y,0,100),z:r(t.z,0,108.883),a:r(t.a)}},h=.0088564517,b=7.787037037,p=function(t){var n=t.l,o=t.a,u=t.b,e=t.alpha,h=void 0===e?1:e;if(!a(n)||!a(o)||!a(u))return null;var b=function(a){return{l:r(a.l,0,100),a:r(a.a,-128,128),b:r(a.b,-128,128),alpha:r(a.alpha)}}({l:Number(n),a:Number(o),b:Number(u),alpha:Number(h)});return i(b)},i=function(a){var t=(a.l+16)/116,r=a.a/500+t,n=t-a.b/200;return u({x:95.047*(Math.pow(r,3)>h?Math.pow(r,3):(r-16/116)/b),y:100*(Math.pow(t,3)>h?Math.pow(t,3):(t-16/116)/b),z:108.883*(Math.pow(n,3)>h?Math.pow(n,3):(n-16/116)/b),a:a.alpha})};module.exports=function(a,r){a.prototype.toLab=function(){return r=e(this.rgba),o=r.y/100,u=r.z/108.883,n=(n=r.x/95.047)>h?Math.cbrt(n):b*n+16/116,a={l:116*(o=o>h?Math.cbrt(o):b*o+16/116)-16,a:500*(n-o),b:200*(o-(u=u>h?Math.cbrt(u):b*u+16/116)),alpha:r.a},{l:t(a.l,2),a:t(a.a,2),b:t(a.b,2),alpha:t(a.alpha,2)};var a,r,n,o,u},r.object.push(p)};
var a=function(a){return"string"==typeof a?a.length>0:"number"==typeof a},t=function(a,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*a)/r},r=function(a,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),a>r?r:a>t?a:t},n=function(a){var t=a/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},o=function(a){return 255*(a>.0031308?1.055*Math.pow(a,1/2.4)-.055:12.92*a)},u=function(a){var t,n=a.x/100,u=a.y/100,e=a.z/100;return t={r:o(3.2404542*n-1.5371385*u-.4985314*e),g:o(-.969266*n+1.8760108*u+.041556*e),b:o(.0556434*n-.2040259*u+1.0572252*e),a:a.a},{r:r(t.r,0,255),g:r(t.g,0,255),b:r(t.b,0,255),a:r(t.a)}},e=function(a){var t,o=n(a.r),u=n(a.g),e=n(a.b);return{x:r((t={x:100*(.4124564*o+.3575761*u+.1804375*e),y:100*(.2126729*o+.7151522*u+.072175*e),z:100*(.0193339*o+.119192*u+.9503041*e),a:a.a}).x,0,95.047),y:r(t.y,0,100),z:r(t.z,0,108.883),a:r(t.a)}},h=.0088564517,b=7.787037037,p=function(t){var n=t.l,o=t.a,u=t.b,e=t.alpha,h=void 0===e?1:e;if(!a(n)||!a(o)||!a(u))return null;var b=function(a){return{l:r(a.l,0,100),a:r(a.a,-128,128),b:r(a.b,-128,128),alpha:r(a.alpha)}}({l:Number(n),a:Number(o),b:Number(u),alpha:Number(h)});return i(b)},i=function(a){var t=(a.l+16)/116,r=a.a/500+t,n=t-a.b/200;return u({x:95.047*(Math.pow(r,3)>h?Math.pow(r,3):(r-16/116)/b),y:100*(Math.pow(t,3)>h?Math.pow(t,3):(t-16/116)/b),z:108.883*(Math.pow(n,3)>h?Math.pow(n,3):(n-16/116)/b),a:a.alpha})};module.exports=function(a,r){a.prototype.toLab=function(){return r=e(this.rgba),o=r.y/100,u=r.z/108.883,n=(n=r.x/95.047)>h?Math.cbrt(n):b*n+16/116,a={l:116*(o=o>h?Math.cbrt(o):b*o+16/116)-16,a:500*(n-o),b:200*(o-(u=u>h?Math.cbrt(u):b*u+16/116)),alpha:r.a},{l:t(a.l,2),a:t(a.a,2),b:t(a.b,2),alpha:t(a.alpha,2)};var a,r,n,o,u},r.object.push(p)};

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

var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r<n?n:r},u=function(r){var n=r/255;return n<.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)},o=function(r){return 255*(r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r)},a=function(r){return{x:t(r.x,0,95.047),y:t(r.y,0,100),z:t(r.z,0,108.883),a:t(r.a)}},e=function(n){var t=n.x,u=n.y,o=n.z,e=n.a,f=void 0===e?1:e;if(!r(t)||!r(u)||!r(o))return null;var y=a({x:Number(t),y:Number(u),z:Number(o),a:Number(f)});return i(y)},i=function(r){var n,u=r.x/100,a=r.y/100,e=r.z/100;return n={r:o(3.2404542*u-1.5371385*a-.4985314*e),g:o(-.969266*u+1.8760108*a+.041556*e),b:o(.0556434*u-.2040259*a+1.0572252*e),a:r.a},{r:t(n.r,0,255),g:t(n.g,0,255),b:t(n.b,0,255),a:t(n.a)}};module.exports=function(r,t){r.prototype.toXyz=function(){return o=u((t=this.rgba).r),e=u(t.g),i=u(t.b),r=a({x:100*(.4124564*o+.3575761*e+.1804375*i),y:100*(.2126729*o+.7151522*e+.072175*i),z:100*(.0193339*o+.119192*e+.9503041*i),a:t.a}),{x:n(r.x,3),y:n(r.y,3),z:n(r.z,3),a:n(r.a,2)};var r,t,o,e,i},t.object.push(e)};
var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},u=function(r){var n=r/255;return n<.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)},o=function(r){return 255*(r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r)},a=function(r){return{x:t(r.x,0,95.047),y:t(r.y,0,100),z:t(r.z,0,108.883),a:t(r.a)}},e=function(n){var t=n.x,u=n.y,o=n.z,e=n.a,f=void 0===e?1:e;if(!r(t)||!r(u)||!r(o))return null;var y=a({x:Number(t),y:Number(u),z:Number(o),a:Number(f)});return i(y)},i=function(r){var n,u=r.x/100,a=r.y/100,e=r.z/100;return n={r:o(3.2404542*u-1.5371385*a-.4985314*e),g:o(-.969266*u+1.8760108*a+.041556*e),b:o(.0556434*u-.2040259*a+1.0572252*e),a:r.a},{r:t(n.r,0,255),g:t(n.g,0,255),b:t(n.b,0,255),a:t(n.a)}};module.exports=function(r,t){r.prototype.toXyz=function(){return o=u((t=this.rgba).r),e=u(t.g),i=u(t.b),r=a({x:100*(.4124564*o+.3575761*e+.1804375*i),y:100*(.2126729*o+.7151522*e+.072175*i),z:100*(.0193339*o+.119192*e+.9503041*i),a:t.a}),{x:n(r.x,3),y:n(r.y,3),z:n(r.z,3),a:n(r.a,2)};var r,t,o,e,i},t.object.push(e)};

@@ -117,2 +117,3 @@ <div align="center">

colord(" hsL( 10, 200% 30 .5!!!").toHslString(); // "hsla(10, 100%, 30%, 0.5)"
colord({ r: NaN, g: -Infinity, b: +Infinity, a: 100500 }).toRgb(); // { r: 0, g: 0, b: 255, a: 1 }
```

@@ -119,0 +120,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc