import Color from "color";
import { fontFamilies } from "./theme";
export const rgba = (c, a) => Color(c).alpha(a).rgb().toString();
export const darken = (c, a) => Color(c).darken(a).toString();
export const lighten = (c, a) => Color(c).lighten(a).toString();
export const mix = (c, b, a) => Color(c).mix(Color(b), a).toString();
export const ff = (v) => {
    var _a;
    const [font, type = "Regular"] = v.split("|");
    // @ts-expect-error FIXME
    const { style, weight } = fontFamilies[font][type];
    // @ts-expect-error FIXME
    const fallback = (_a = fontFamilies[font].fallback) !== null && _a !== void 0 ? _a : "Arial";
    return {
        fontFamily: `${font}, ${fallback}`,
        fontWeight: weight,
        fontStyle: style,
    };
};
export const ensureContrast = (color1, color2) => {
    const colorL1 = Color(color1).luminosity() + 0.05;
    const colorL2 = Color(color2).luminosity() + 0.05;
    const lRatio = colorL1 > colorL2 ? colorL1 / colorL2 : colorL2 / colorL1;
    if (lRatio < 1.5) {
        return Color(color1).rotate(180).negate().string();
    }
    return color1;
};
//# sourceMappingURL=helpers.js.map