function t(t){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(null==n)throw new Error(`The color "${t}" is not in hex format`);return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}}function n(t){return"#"+[t.r,t.g,t.b].map((t=>t.toString(16).padStart(2,"0"))).join("")}function r(t){const n=t.r/255,r=t.g/255,h=t.b/255,o=Math.max(n,Math.max(r,h)),a=Math.min(n,Math.min(r,h)),u=o-a;let e;e=0===u?0:o===n?(r-h)/u%6*60:o===r?60*((h-n)/u+2):60*((n-r)/u+4);const c=(o+a)/2;return{h:e,s:0===u?0:u/(1-Math.abs(2*c-1)),l:c}}function h(t){const n=(1-Math.abs(2*t.l-1))*t.s,r=n*(1-Math.abs(t.h/60%2-1)),h=t.l-n/2;let o;return t.h>=0&&t.h<60?o={r:n,g:r,b:0}:t.h>=60&&t.h<120?o={r:r,g:n,b:0}:t.h>=120&&t.h<180?o={r:0,g:n,b:r}:t.h>=180&&t.h<240?o={r:0,g:r,b:n}:t.h>=240&&t.h<300?o={r:r,g:0,b:n}:t.h>=300&&t.h<360&&(o={r:n,g:0,b:r}),{r:255*(o.r+h),g:255*(o.g+h),b:255*(o.b+h)}}function o(t){return.2126*i(t.r)+.7152*i(t.g)+.0722*i(t.b)}function a(t){return o(t)<.5}function u(t,n){const r=o(t),h=o(n);return r>h?c(r,h):c(h,r)}function e(t,n){const r=t=>Math.round(Math.max(0,Math.min(255,t+Math.round(2.55*n))));return{r:r(t.r),g:r(t.g),b:r(t.b)}}function c(t,n){return(t+.05)/(n+.05)}function i(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}export{u as getContrastRatio,o as getLuminosity,t as hexToRgb,h as hslToRgb,a as isDark,n as rgbToHex,r as rgbToHsl,e as shadeColor};
//# sourceMappingURL=color.js.map
