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

@kurkle/color

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kurkle/color - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

12

dist/color.d.ts

@@ -39,3 +39,3 @@ /**

/**
* Rounds to decimal to nearest integer
* Rounds decimal to nearest integer
* @param {number} v - the number to round

@@ -141,5 +141,11 @@ */

constructor(input: string | number[] | Color | RGBA);
/** @type {RGBA} */
/**
* @type {RGBA}
* @hidden
**/
_rgb: RGBA;
/** @type {boolean} */
/**
* @type {boolean}
* @hidden
**/
_valid: boolean;

@@ -146,0 +152,0 @@ /**

/*!
* @kurkle/color v0.1.6
* @kurkle/color v0.1.7
* https://github.com/kurkle/color#readme

@@ -51,2 +51,5 @@ * (c) 2020 Jukka Kurkela

}
function b2p(v) {
return lim(round(v / 2.55), 0, 100);
}
function n2b(v) {

@@ -556,6 +559,7 @@ return lim(round(v * 255), 0, 255);

function index(input) {
function index_esm(input) {
return new Color(input);
}
export default index;
export default index_esm;
export { Color, b2n, b2p, hexParse, hexString, hsl2rgb, hslString, hsv2rgb, hueParse, hwb2rgb, n2b, n2p, nameParse, p2b, rgb2hsl, rgbParse, rgbString, rotate, round };
/*!
* @kurkle/color v0.1.6
* @kurkle/color v0.1.7
* https://github.com/kurkle/color#readme

@@ -8,3 +8,3 @@ * (c) 2020 Jukka Kurkela

/*!
* @kurkle/color v0.1.6
* @kurkle/color v0.1.7
* https://github.com/kurkle/color#readme

@@ -14,3 +14,3 @@ * (c) 2020 Jukka Kurkela

*/
const e={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},f="0123456789ABCDEF",t=e=>f[15&e],r=e=>f[(240&e)>>4]+f[15&e],a=e=>(240&e)>>4==(15&e);function n(e){var f=function(e){return a(e.r)&&a(e.g)&&a(e.b)&&a(e.a)}(e)?t:r;return e?"#"+f(e.r)+f(e.g)+f(e.b)+(e.a<255?f(e.a):""):e}function c(e){return e+.5|0}const s=(e,f,t)=>Math.max(Math.min(e,t),f);function i(e){return s(c(2.55*e),0,255)}function b(e){return s(c(255*e),0,255)}function g(e){return s(c(e/2.55)/100,0,1)}function d(e){return s(c(100*e),0,100)}const u=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const o=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function h(e,f,t){const r=f*Math.min(t,1-t),a=(f,a=(f+e/30)%12)=>t-r*Math.max(Math.min(a-3,9-a,1),-1);return[a(0),a(8),a(4)]}function l(e,f,t){const r=(r,a=(r+e/60)%6)=>t-t*f*Math.max(Math.min(a,4-a,1),0);return[r(5),r(3),r(1)]}function m(e,f,t){const r=h(e,1,.5);let a;for(f+t>1&&(a=1/(f+t),f*=a,t*=a),a=0;a<3;a++)r[a]*=1-f-t,r[a]+=f;return r}function y(e){const f=e.r/255,t=e.g/255,r=e.b/255,a=Math.max(f,t,r),n=Math.min(f,t,r),c=(a+n)/2;let s,i,b;return a!==n&&(b=a-n,i=c>.5?b/(2-a-n):b/(a+n),s=a===f?(t-r)/b+(t<r?6:0):a===t?(r-f)/b+2:(f-t)/b+4,s=60*s+.5),[0|s,i||0,c]}function Y(e,f,t,r){return(Array.isArray(f)?e(f[0],f[1],f[2]):e(f,t,r)).map(b)}function p(e,f,t){return Y(h,e,f,t)}function x(e){return(e%360+360)%360}function v(e){const f=o.exec(e);let t,r=255;if(!f)return;f[5]!==t&&(r=f[6]?i(+f[5]):b(+f[5]));const a=x(+f[2]),n=+f[3]/100,c=+f[4]/100;return t="hwb"===f[1]?function(e,f,t){return Y(m,e,f,t)}(a,n,c):"hsv"===f[1]?function(e,f,t){return Y(l,e,f,t)}(a,n,c):p(a,n,c),{r:t[0],g:t[1],b:t[2],a:r}}var w={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"};const F=function(e){var f,t,r,a,n,c={},s=Object.keys(e),i=Object.keys(w);for(f=0;f<s.length;f++){for(a=n=s[f],t=0;t<i.length;t++)r=i[t],n=n.replace(r,w[r]);r=parseInt(e[a],16),c[n]=[r>>16&255,r>>8&255,255&r]}return c}({OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"});function X(e,f,t){if(e){let r=y(e);r[f]=Math.max(0,Math.min(r[f]+r[f]*t,0===f?360:1)),r=p(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function M(e,f){return e?Object.assign(f||{},e):e}function k(e){var f={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(f={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(f.a=b(e[3]))):(f=M(e,{r:0,g:0,b:0,a:1})).a=b(f.a),f}function O(e){return"r"===e.charAt(0)?function(e){const f=u.exec(e);let t,r,a,n=255;if(f){if(f[7]!==t){const e=+f[7];n=255&(f[8]?i(e):255*e)}return t=+f[1],r=+f[3],a=+f[5],t=255&(f[2]?i(t):t),r=255&(f[4]?i(r):r),a=255&(f[6]?i(a):a),{r:t,g:r,b:a,a:n}}}(e):v(e)}F.transparent=[0,0,0,0];class _{constructor(f){if(f instanceof _)return f;const t=typeof f;let r;var a,n,c;"object"===t?r=k(f):"string"===t&&(c=(a=f).length,"#"===a[0]&&(4===c||5===c?n={r:255&17*e[a[1]],g:255&17*e[a[2]],b:255&17*e[a[3]],a:5===c?17*e[a[4]]:255}:7!==c&&9!==c||(n={r:e[a[1]]<<4|e[a[2]],g:e[a[3]]<<4|e[a[4]],b:e[a[5]]<<4|e[a[6]],a:9===c?e[a[7]]<<4|e[a[8]]:255})),r=n||function(e){var f=F[e];return f&&{r:f[0],g:f[1],b:f[2],a:4===f.length?f[3]:255}}(f)||O(f)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=M(this._rgb);return e&&(e.a=g(e.a)),e}set rgb(e){this._rgb=k(e)}rgbString(){return(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${g(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`);var e}hexString(){return n(this._rgb)}hslString(){return function(e){if(!e)return;const f=y(e),t=f[0],r=d(f[1]),a=d(f[2]);return e.a<255?`hsla(${t}, ${r}%, ${a}%, ${g(e.a)})`:`hsl(${t}, ${r}%, ${a}%)`}(this._rgb)}mix(e,f){const t=this;if(e){const r=t.rgb,a=e.rgb;let n;const c=f===n?.5:f,s=2*c-1,i=r.a-a.a,b=((s*i==-1?s:(s+i)/(1+s*i))+1)/2;n=1-b,r.r=255&b*r.r+n*a.r+.5,r.g=255&b*r.g+n*a.g+.5,r.b=255&b*r.b+n*a.b+.5,r.a=c*r.a+(1-c)*a.a,t.rgb=r}return t}clone(){return new _(this.rgb)}alpha(e){return this._rgb.a=b(e),this}clearer(e){return this._rgb.a*=1-e,this}greyscale(){const e=this._rgb,f=c(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=f,this}opaquer(e){return this._rgb.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return X(this._rgb,2,e),this}darken(e){return X(this._rgb,2,-e),this}saturate(e){return X(this._rgb,1,e),this}desaturate(e){return X(this._rgb,1,-e),this}rotate(e){return function(e,f){var t=y(e);t[0]=x(t[0]+f),t=p(t),e.r=t[0],e.g=t[1],e.b=t[2]}(this._rgb,e),this}}export default function(e){return new _(e)}
const e={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},f="0123456789ABCDEF",t=e=>f[15&e],r=e=>f[(240&e)>>4]+f[15&e],a=e=>(240&e)>>4==(15&e);function n(f){var t,r=f.length;return"#"===f[0]&&(4===r||5===r?t={r:255&17*e[f[1]],g:255&17*e[f[2]],b:255&17*e[f[3]],a:5===r?17*e[f[4]]:255}:7!==r&&9!==r||(t={r:e[f[1]]<<4|e[f[2]],g:e[f[3]]<<4|e[f[4]],b:e[f[5]]<<4|e[f[6]],a:9===r?e[f[7]]<<4|e[f[8]]:255})),t}function c(e){var f=function(e){return a(e.r)&&a(e.g)&&a(e.b)&&a(e.a)}(e)?t:r;return e?"#"+f(e.r)+f(e.g)+f(e.b)+(e.a<255?f(e.a):""):e}function i(e){return e+.5|0}const s=(e,f,t)=>Math.max(Math.min(e,t),f);function b(e){return s(i(2.55*e),0,255)}function g(e){return s(i(e/2.55),0,100)}function d(e){return s(i(255*e),0,255)}function u(e){return s(i(e/2.55)/100,0,1)}function o(e){return s(i(100*e),0,100)}const h=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function l(e){const f=h.exec(e);let t,r,a,n=255;if(f){if(f[7]!==t){const e=+f[7];n=255&(f[8]?b(e):255*e)}return t=+f[1],r=+f[3],a=+f[5],t=255&(f[2]?b(t):t),r=255&(f[4]?b(r):r),a=255&(f[6]?b(a):a),{r:t,g:r,b:a,a:n}}}function m(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${u(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const y=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function p(e,f,t){const r=f*Math.min(t,1-t),a=(f,a=(f+e/30)%12)=>t-r*Math.max(Math.min(a-3,9-a,1),-1);return[a(0),a(8),a(4)]}function Y(e,f,t){const r=(r,a=(r+e/60)%6)=>t-t*f*Math.max(Math.min(a,4-a,1),0);return[r(5),r(3),r(1)]}function x(e,f,t){const r=p(e,1,.5);let a;for(f+t>1&&(a=1/(f+t),f*=a,t*=a),a=0;a<3;a++)r[a]*=1-f-t,r[a]+=f;return r}function v(e){const f=e.r/255,t=e.g/255,r=e.b/255,a=Math.max(f,t,r),n=Math.min(f,t,r),c=(a+n)/2;let i,s,b;return a!==n&&(b=a-n,s=c>.5?b/(2-a-n):b/(a+n),i=a===f?(t-r)/b+(t<r?6:0):a===t?(r-f)/b+2:(f-t)/b+4,i=60*i+.5),[0|i,s||0,c]}function w(e,f,t,r){return(Array.isArray(f)?e(f[0],f[1],f[2]):e(f,t,r)).map(d)}function F(e,f,t){return w(p,e,f,t)}function X(e,f,t){return w(x,e,f,t)}function M(e,f,t){return w(Y,e,f,t)}function k(e){return(e%360+360)%360}function O(e){const f=y.exec(e);let t,r=255;if(!f)return;f[5]!==t&&(r=f[6]?b(+f[5]):d(+f[5]));const a=k(+f[2]),n=+f[3]/100,c=+f[4]/100;return t="hwb"===f[1]?X(a,n,c):"hsv"===f[1]?M(a,n,c):F(a,n,c),{r:t[0],g:t[1],b:t[2],a:r}}function _(e,f){var t=v(e);t[0]=k(t[0]+f),t=F(t),e.r=t[0],e.g=t[1],e.b=t[2]}function S(e){if(!e)return;const f=v(e),t=f[0],r=o(f[1]),a=o(f[2]);return e.a<255?`hsla(${t}, ${r}%, ${a}%, ${u(e.a)})`:`hsl(${t}, ${r}%, ${a}%)`}var T={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"};const Z=function(e){var f,t,r,a,n,c={},i=Object.keys(e),s=Object.keys(T);for(f=0;f<i.length;f++){for(a=n=i[f],t=0;t<s.length;t++)r=s[t],n=n.replace(r,T[r]);r=parseInt(e[a],16),c[n]=[r>>16&255,r>>8&255,255&r]}return c}({OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"});function $(e){var f=Z[e];return f&&{r:f[0],g:f[1],b:f[2],a:4===f.length?f[3]:255}}function E(e,f,t){if(e){let r=v(e);r[f]=Math.max(0,Math.min(r[f]+r[f]*t,0===f?360:1)),r=F(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function R(e,f){return e?Object.assign(f||{},e):e}function A(e){var f={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(f={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(f.a=d(e[3]))):(f=R(e,{r:0,g:0,b:0,a:1})).a=d(f.a),f}Z.transparent=[0,0,0,0];class P{constructor(e){if(e instanceof P)return e;const f=typeof e;let t;var r;"object"===f?t=A(e):"string"===f&&(t=n(e)||$(e)||("r"===(r=e).charAt(0)?l(r):O(r))),this._rgb=t,this._valid=!!t}get valid(){return this._valid}get rgb(){var e=R(this._rgb);return e&&(e.a=u(e.a)),e}set rgb(e){this._rgb=A(e)}rgbString(){return m(this._rgb)}hexString(){return c(this._rgb)}hslString(){return S(this._rgb)}mix(e,f){const t=this;if(e){const r=t.rgb,a=e.rgb;let n;const c=f===n?.5:f,i=2*c-1,s=r.a-a.a,b=((i*s==-1?i:(i+s)/(1+i*s))+1)/2;n=1-b,r.r=255&b*r.r+n*a.r+.5,r.g=255&b*r.g+n*a.g+.5,r.b=255&b*r.b+n*a.b+.5,r.a=c*r.a+(1-c)*a.a,t.rgb=r}return t}clone(){return new P(this.rgb)}alpha(e){return this._rgb.a=d(e),this}clearer(e){return this._rgb.a*=1-e,this}greyscale(){const e=this._rgb,f=i(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=f,this}opaquer(e){return this._rgb.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return E(this._rgb,2,e),this}darken(e){return E(this._rgb,2,-e),this}saturate(e){return E(this._rgb,1,e),this}desaturate(e){return E(this._rgb,1,-e),this}rotate(e){return _(this._rgb,e),this}}export default function(e){return new P(e)}export{P as Color,u as b2n,g as b2p,n as hexParse,c as hexString,F as hsl2rgb,S as hslString,M as hsv2rgb,O as hueParse,X as hwb2rgb,d as n2b,o as n2p,$ as nameParse,b as p2b,v as rgb2hsl,l as rgbParse,m as rgbString,_ as rotate,i as round};
//# sourceMappingURL=color.esm.min.js.map
/*!
* @kurkle/color v0.1.6
* @kurkle/color v0.1.7
* https://github.com/kurkle/color#readme

@@ -4,0 +4,0 @@ * (c) 2020 Jukka Kurkela

/*!
* @kurkle/color v0.1.6
* @kurkle/color v0.1.7
* https://github.com/kurkle/color#readme

@@ -4,0 +4,0 @@ * (c) 2020 Jukka Kurkela

{
"name": "@kurkle/color",
"version": "0.1.6",
"version": "0.1.7",
"description": "css color parsing, manupulation and conversion",

@@ -5,0 +5,0 @@ "main": "dist/color.js",

@@ -67,2 +67,4 @@ # @kurkle/color

**note** The docs are for the ESM module. UMD module only exports the [default export](https://kurkle.github.io/color/globals.html#_default)
## Benchmarks

@@ -69,0 +71,0 @@

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