var r="#03BCD4",t=function(r){return r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)},a=function(r){var a=r.replace("#",""),n=parseInt(a.slice(0,2),16)/255,c=parseInt(a.slice(2,4),16)/255,e=parseInt(a.slice(4,6),16)/255;return.2126*t(n)+.7152*t(c)+.0722*t(e)},n=function(r){var t,a=r.replace(/\s+/gi,""),n=null===(t=a.match(/^#([0-9a-f]{3,8})$/i))||void 0===t?void 0:t[1];if(n){var c=n.length;if(3===c||4===c)return{r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:4===c?parseInt(n[3].repeat(2),16)/255:1};if(6===c||8===c)return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16),a:8===c?parseInt(n.slice(6,8),16)/255:1}}var e=a.match(/^rgba?\((\d+),(\d+),(\d+)(?:,([\d.]+))?\)$/i);if(e)return{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10),a:void 0!==e[4]?parseFloat(e[4]):1};throw new Error("Unsupported color format: ".concat(a))},c=function(r){return r.toString(16).padStart(2,"0")},e=function(r,t){var a=r.r,n=r.g,e=r.b,o=r.a;return t?"#".concat(c(a)).concat(c(n)).concat(c(e)).concat(c(Math.round(255*o))):"#".concat(c(a)).concat(c(n)).concat(c(e))},o=function(r,t){var a=r.r,n=r.g,c=r.b,e=r.a;return t?"rgba(".concat(a,", ").concat(n,", ").concat(c,", ").concat(Math.round(100*e)/100,")"):"rgb(".concat(a,", ").concat(n,", ").concat(c,")")};export{e as channelsToHex,o as channelsToRgba,r as defaultColor,a as getLuminance,n as parseColor};
//# sourceMappingURL=utils.js.map
