const o=t=>/^#([0-9a-fA-F]{3}|[0-9a-fA-f]{6})$/.test(t),l=(t,e)=>{let s=t.toLowerCase();if(o(t)){if(s.length===4){let r="#";for(let i=1;i<4;i+=1)r+=s.slice(i,i+1).concat(s.slice(i,i+1));s=r}const n=[];for(let r=1;r<7;r+=2)n.push(parseInt("0x"+s.slice(r,r+2)));return e?"RGBA("+n.join(",")+","+e+")":"RGB("+n.join(",")+")"}return s},c=t=>{if(!o(t))return;const[e,s,n]=l(t).replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",").map(r=>Number(r));return .299*e+.578*s+.114*n<192},g=(t,e)=>(t=t.indexOf("#")>=0?t.substring(1,t.length):t,e=Math.trunc(255*e/100),`#${a(t.substring(0,2),e)}${a(t.substring(2,4),e)}${a(t.substring(4,6),e)}`),a=(t,e)=>{const s=parseInt(t,16)+e,n=s>255?255:s;return n.toString(16).length>1?n.toString(16):`0${n.toString(16)}`};export{c,l as h,o as i,g as l};