@frontify/fondue
Version:
Design system of Frontify
23 lines (22 loc) • 606 B
JavaScript
import { TinyColor as g } from "@ctrl/tinycolor";
import { ColorFormat as n } from "../types/colors.es.js";
const u = (r, o, a = !0) => {
const t = new g(l(r));
switch (o) {
case n.Rgba:
return t.toRgbString();
case n.Hex: {
const e = t.toHexString();
return a && r.alpha && r.alpha < 1 ? `${e} ${Math.trunc(t.getAlpha() * 100)}%` : e;
}
default:
return t.toHexString();
}
}, l = (r) => {
const { red: o, green: a, blue: t, alpha: e } = r;
return { r: o, g: a, b: t, a: e };
};
export {
u as getColorDisplayValue
};
//# sourceMappingURL=colors.es.js.map