/** Converts a hex value to RGBA */
export const hexToRgb = (hex) => {
    const [, r, g, b, a] = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?/.exec(hex) ?? [];
    const NOTHING = Symbol();
    const values = [
        parseInt(r, 16),
        parseInt(g, 16),
        parseInt(b, 16),
        (typeof a === 'string' && a.length) ? parseInt(a, 16) : NOTHING,
    ];
    return values.filter(x => x !== NOTHING);
};
// Gets the rgba value from an element
export const getColor = (el, prop) => {
    const [, r, g, b] = (getComputedStyle(el, null)
        .getPropertyValue(prop)
        .match(/rgba?\((\d+),\s+(\d+),\s+(\d+).*\)/) ?? [])
        .map(n => +n);
    return [r, g, b];
};
//# sourceMappingURL=hex-to-rgb.js.map