@aplus-frontend/ui
Version:
2 lines (1 loc) • 389 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(t,r=1){if(t=t?.replace(/^#/,""),t.length===3&&(t=t.split("").map(n=>n+n).join("")),t.length!==6)throw new Error("Invalid hex color code");const o=parseInt(t.substring(0,2),16),s=parseInt(t.substring(2,4),16),e=parseInt(t.substring(4,6),16);return`rgba(${o}, ${s}, ${e}, ${r})`}exports.hexToRgba=i;