synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
39 lines (38 loc) • 1.05 kB
JavaScript
import { COLOR_PALETTE_EVEN as a, COLOR_PALETTE_ODD as i } from "../../utils/functions/colorPalette.js";
function P(o, e) {
const t = e[3];
return [
Math.floor((1 - t) * o[0] + t * e[0] + 0.5),
Math.floor((1 - t) * o[1] + t * e[1] + 0.5),
Math.floor((1 - t) * o[2] + t * e[2] + 0.5)
];
}
const c = 5, E = Math.floor(a.length / c);
function _(o, e) {
let t = [];
const l = [];
let s = -1;
o % 2 === 0 ? (t = a, s = o * c) : (t = i, s = (o - 1) * c);
const n = [];
for (let r = 0; r < e; r++) {
const f = r % (c * 2) < 2 || r % (c * 2) > 7 ? "white" : "black", h = t[(s + r) % t.length];
n.push(h), l.push(f);
}
return { colorPalette: n, textColors: l };
}
function C(o, e, t) {
let l = [];
o === "even" ? l = a : l = i;
const s = [];
for (let n = 0; n < t; n++) {
const r = n * c, f = (e + Math.floor(n / E)) % c, h = l[(r + f) % l.length];
s.push(h);
}
return s;
}
export {
_ as getColorPalette,
C as getContrastColorPalette,
P as rgba2rgb
};
//# sourceMappingURL=ColorGradient.js.map