@kurkle/color
Advanced tools
Comparing version 0.1.8 to 0.1.9
/*! | ||
* @kurkle/color v0.1.8 | ||
* @kurkle/color v0.1.9 | ||
* https://github.com/kurkle/color#readme | ||
@@ -209,3 +209,3 @@ * (c) 2020 Jukka Kurkela | ||
var map$1 = { | ||
const map$1 = { | ||
x: 'dark', | ||
@@ -239,19 +239,3 @@ Z: 'light', | ||
}; | ||
function unpack(obj) { | ||
var unpacked = {}; | ||
var keys = Object.keys(obj); | ||
var tkeys = Object.keys(map$1); | ||
var i, j, k, ok, nk; | ||
for (i = 0; i < keys.length; i++) { | ||
ok = nk = keys[i]; | ||
for (j = 0; j < tkeys.length; j++) { | ||
k = tkeys[j]; | ||
nk = nk.replace(k, map$1[k]); | ||
} | ||
k = parseInt(obj[ok], 16); | ||
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF]; | ||
} | ||
return unpacked; | ||
} | ||
const names = unpack({ | ||
const names = { | ||
OiceXe: 'f0f8ff', | ||
@@ -405,7 +389,27 @@ antiquewEte: 'faebd7', | ||
LwgYF: '9acd32' | ||
}); | ||
}; | ||
function unpack() { | ||
const unpacked = {}; | ||
const keys = Object.keys(names); | ||
const tkeys = Object.keys(map$1); | ||
let i, j, k, ok, nk; | ||
for (i = 0; i < keys.length; i++) { | ||
ok = nk = keys[i]; | ||
for (j = 0; j < tkeys.length; j++) { | ||
k = tkeys[j]; | ||
nk = nk.replace(k, map$1[k]); | ||
} | ||
k = parseInt(names[ok], 16); | ||
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF]; | ||
} | ||
return unpacked; | ||
} | ||
names.transparent = [0, 0, 0, 0]; | ||
let names$1; | ||
function nameParse(str) { | ||
var a = names[str.toLowerCase()]; | ||
if (!names$1) { | ||
names$1 = unpack(); | ||
names$1.transparent = [0, 0, 0, 0]; | ||
} | ||
const a = names$1[str.toLowerCase()]; | ||
return a && { | ||
@@ -412,0 +416,0 @@ r: a[0], |
/*! | ||
* @kurkle/color v0.1.8 | ||
* @kurkle/color v0.1.9 | ||
* https://github.com/kurkle/color#readme | ||
@@ -212,3 +212,3 @@ * (c) 2020 Jukka Kurkela | ||
var map$1 = { | ||
const map$1 = { | ||
x: 'dark', | ||
@@ -242,19 +242,3 @@ Z: 'light', | ||
}; | ||
function unpack(obj) { | ||
var unpacked = {}; | ||
var keys = Object.keys(obj); | ||
var tkeys = Object.keys(map$1); | ||
var i, j, k, ok, nk; | ||
for (i = 0; i < keys.length; i++) { | ||
ok = nk = keys[i]; | ||
for (j = 0; j < tkeys.length; j++) { | ||
k = tkeys[j]; | ||
nk = nk.replace(k, map$1[k]); | ||
} | ||
k = parseInt(obj[ok], 16); | ||
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF]; | ||
} | ||
return unpacked; | ||
} | ||
const names = unpack({ | ||
const names = { | ||
OiceXe: 'f0f8ff', | ||
@@ -408,7 +392,27 @@ antiquewEte: 'faebd7', | ||
LwgYF: '9acd32' | ||
}); | ||
}; | ||
function unpack() { | ||
const unpacked = {}; | ||
const keys = Object.keys(names); | ||
const tkeys = Object.keys(map$1); | ||
let i, j, k, ok, nk; | ||
for (i = 0; i < keys.length; i++) { | ||
ok = nk = keys[i]; | ||
for (j = 0; j < tkeys.length; j++) { | ||
k = tkeys[j]; | ||
nk = nk.replace(k, map$1[k]); | ||
} | ||
k = parseInt(names[ok], 16); | ||
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF]; | ||
} | ||
return unpacked; | ||
} | ||
names.transparent = [0, 0, 0, 0]; | ||
let names$1; | ||
function nameParse(str) { | ||
var a = names[str.toLowerCase()]; | ||
if (!names$1) { | ||
names$1 = unpack(); | ||
names$1.transparent = [0, 0, 0, 0]; | ||
} | ||
const a = names$1[str.toLowerCase()]; | ||
return a && { | ||
@@ -415,0 +419,0 @@ r: a[0], |
/*! | ||
* @kurkle/color v0.1.8 | ||
* @kurkle/color v0.1.9 | ||
* https://github.com/kurkle/color#readme | ||
@@ -7,3 +7,3 @@ * (c) 2020 Jukka Kurkela | ||
*/ | ||
!function(e,f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define(f):(e=e||self)["@kurkle/color"]=f()}(this,(function(){"use strict";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 i(e){return e+.5|0}const s=(e,f,t)=>Math.max(Math.min(e,t),f);function c(e){return s(i(2.55*e),0,255)}function b(e){return s(i(255*e),0,255)}function d(e){return s(i(e/2.55)/100,0,1)}function g(e){return s(i(100*e),0,100)}const o=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const u=/^(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),i=(a+n)/2;let s,c,b;return a!==n&&(b=a-n,c=i>.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,c||0,i]}function p(e,f,t,r){return(Array.isArray(f)?e(f[0],f[1],f[2]):e(f,t,r)).map(b)}function Y(e,f,t){return p(h,e,f,t)}function v(e){return(e%360+360)%360}function x(e){const f=u.exec(e);let t,r=255;if(!f)return;f[5]!==t&&(r=f[6]?c(+f[5]):b(+f[5]));const a=v(+f[2]),n=+f[3]/100,i=+f[4]/100;return t="hwb"===f[1]?function(e,f,t){return p(m,e,f,t)}(a,n,i):"hsv"===f[1]?function(e,f,t){return p(l,e,f,t)}(a,n,i):Y(a,n,i),{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,i={},s=Object.keys(e),c=Object.keys(w);for(f=0;f<s.length;f++){for(a=n=s[f],t=0;t<c.length;t++)r=c[t],n=n.replace(r,w[r]);r=parseInt(e[a],16),i[n]=[r>>16&255,r>>8&255,255&r]}return i}({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,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=Y(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function k(e,f){return e?Object.assign(f||{},e):e}function X(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=k(e,{r:0,g:0,b:0,a:1})).a=b(f.a),f}function M(e){return"r"===e.charAt(0)?function(e){const f=o.exec(e);let t,r,a,n=255;if(f){if(f[7]!==t){const e=+f[7];n=255&(f[8]?c(e):255*e)}return t=+f[1],r=+f[3],a=+f[5],t=255&(f[2]?c(t):t),r=255&(f[4]?c(r):r),a=255&(f[6]?c(a):a),{r:t,g:r,b:a,a:n}}}(e):x(e)}F.transparent=[0,0,0,0];class O{constructor(f){if(f instanceof O)return f;const t=typeof f;let r;var a,n,i;"object"===t?r=X(f):"string"===t&&(i=(a=f).length,"#"===a[0]&&(4===i||5===i?n={r:255&17*e[a[1]],g:255&17*e[a[2]],b:255&17*e[a[3]],a:5===i?17*e[a[4]]:255}:7!==i&&9!==i||(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===i?e[a[7]]<<4|e[a[8]]:255})),r=n||function(e){var f=F[e.toLowerCase()];return f&&{r:f[0],g:f[1],b:f[2],a:4===f.length?f[3]:255}}(f)||M(f)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=k(this._rgb);return e&&(e.a=d(e.a)),e}set rgb(e){this._rgb=X(e)}rgbString(){return this._valid?(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${d(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`):this._rgb;var e}hexString(){return this._valid?n(this._rgb):this._rgb}hslString(){return this._valid?function(e){if(!e)return;const f=y(e),t=f[0],r=g(f[1]),a=g(f[2]);return e.a<255?`hsla(${t}, ${r}%, ${a}%, ${d(e.a)})`:`hsl(${t}, ${r}%, ${a}%)`}(this._rgb):this._rgb}mix(e,f){const t=this;if(e){const r=t.rgb,a=e.rgb;let n;const i=f===n?.5:f,s=2*i-1,c=r.a-a.a,b=((s*c==-1?s:(s+c)/(1+s*c))+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=i*r.a+(1-i)*a.a,t.rgb=r}return t}clone(){return new O(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=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 _(this._rgb,2,e),this}darken(e){return _(this._rgb,2,-e),this}saturate(e){return _(this._rgb,1,e),this}desaturate(e){return _(this._rgb,1,-e),this}rotate(e){return function(e,f){var t=y(e);t[0]=v(t[0]+f),t=Y(t),e.r=t[0],e.g=t[1],e.b=t[2]}(this._rgb,e),this}}return function(e){return new O(e)}})); | ||
!function(e,f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define(f):(e=e||self)["@kurkle/color"]=f()}(this,(function(){"use strict";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 i(e){return e+.5|0}const s=(e,f,t)=>Math.max(Math.min(e,t),f);function c(e){return s(i(2.55*e),0,255)}function b(e){return s(i(255*e),0,255)}function d(e){return s(i(e/2.55)/100,0,1)}function g(e){return s(i(100*e),0,100)}const o=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const u=/^(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),i=(a+n)/2;let s,c,b;return a!==n&&(b=a-n,c=i>.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,c||0,i]}function p(e,f,t,r){return(Array.isArray(f)?e(f[0],f[1],f[2]):e(f,t,r)).map(b)}function Y(e,f,t){return p(h,e,f,t)}function x(e){return(e%360+360)%360}function v(e){const f=u.exec(e);let t,r=255;if(!f)return;f[5]!==t&&(r=f[6]?c(+f[5]):b(+f[5]));const a=x(+f[2]),n=+f[3]/100,i=+f[4]/100;return t="hwb"===f[1]?function(e,f,t){return p(m,e,f,t)}(a,n,i):"hsv"===f[1]?function(e,f,t){return p(l,e,f,t)}(a,n,i):Y(a,n,i),{r:t[0],g:t[1],b:t[2],a:r}}const 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"},F={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"};let _;function k(e){_||(_=function(){const e={},f=Object.keys(F),t=Object.keys(w);let r,a,n,i,s;for(r=0;r<f.length;r++){for(i=s=f[r],a=0;a<t.length;a++)n=t[a],s=s.replace(n,w[n]);n=parseInt(F[i],16),e[s]=[n>>16&255,n>>8&255,255&n]}return e}(),_.transparent=[0,0,0,0]);const f=_[e.toLowerCase()];return f&&{r:f[0],g:f[1],b:f[2],a:4===f.length?f[3]:255}}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=Y(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 O(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 S(e){return"r"===e.charAt(0)?function(e){const f=o.exec(e);let t,r,a,n=255;if(f){if(f[7]!==t){const e=+f[7];n=255&(f[8]?c(e):255*e)}return t=+f[1],r=+f[3],a=+f[5],t=255&(f[2]?c(t):t),r=255&(f[4]?c(r):r),a=255&(f[6]?c(a):a),{r:t,g:r,b:a,a:n}}}(e):v(e)}class T{constructor(f){if(f instanceof T)return f;const t=typeof f;let r;var a,n,i;"object"===t?r=O(f):"string"===t&&(i=(a=f).length,"#"===a[0]&&(4===i||5===i?n={r:255&17*e[a[1]],g:255&17*e[a[2]],b:255&17*e[a[3]],a:5===i?17*e[a[4]]:255}:7!==i&&9!==i||(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===i?e[a[7]]<<4|e[a[8]]:255})),r=n||k(f)||S(f)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=M(this._rgb);return e&&(e.a=d(e.a)),e}set rgb(e){this._rgb=O(e)}rgbString(){return this._valid?(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${d(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`):this._rgb;var e}hexString(){return this._valid?n(this._rgb):this._rgb}hslString(){return this._valid?function(e){if(!e)return;const f=y(e),t=f[0],r=g(f[1]),a=g(f[2]);return e.a<255?`hsla(${t}, ${r}%, ${a}%, ${d(e.a)})`:`hsl(${t}, ${r}%, ${a}%)`}(this._rgb):this._rgb}mix(e,f){const t=this;if(e){const r=t.rgb,a=e.rgb;let n;const i=f===n?.5:f,s=2*i-1,c=r.a-a.a,b=((s*c==-1?s:(s+c)/(1+s*c))+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=i*r.a+(1-i)*a.a,t.rgb=r}return t}clone(){return new T(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=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 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=Y(t),e.r=t[0],e.g=t[1],e.b=t[2]}(this._rgb,e),this}}return function(e){return new T(e)}})); | ||
//# sourceMappingURL=color.min.js.map |
{ | ||
"name": "@kurkle/color", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "css color parsing, manupulation and conversion", | ||
@@ -42,3 +42,2 @@ "main": "dist/color.js", | ||
"assert": "^2.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"benchmark": "^2.1.4", | ||
@@ -55,10 +54,10 @@ "chartjs-color": "^2.4.1", | ||
"csscolorparser": "^1.0.3", | ||
"eslint": "^7.1.0", | ||
"eslint": "^7.2.0", | ||
"eslint-config-chartjs": "^0.2.0", | ||
"eslint-config-defaults": "^9.0.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-import": "^2.21.1", | ||
"eslint-plugin-react": "^7.20.0", | ||
"fs": "0.0.1-security", | ||
"perf_hooks": "0.0.1", | ||
"rollup": "^2.13.1", | ||
"rollup": "^2.15.0", | ||
"rollup-plugin-cleanup": "^3.1.1", | ||
@@ -70,3 +69,3 @@ "rollup-plugin-istanbul": "^2.0.1", | ||
"typedoc": "^0.17.7", | ||
"typedoc-plugin-external-module-name": "^4.0.0", | ||
"typedoc-plugin-external-module-name": "^4.0.3", | ||
"typescript": "^3.9.5", | ||
@@ -73,0 +72,0 @@ "util": "^0.12.3" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40018
29
1389