@elliemae/ds-wysiwygeditor
Version:
Ellie Mae - Dim Sum - WYSIWYG Editor
25 lines (19 loc) • 776 B
JavaScript
function sinToHex(i, size, phase) {
var sin = Math.sin(Math.PI / size * 2 * i + phase);
var int = Math.floor(sin * 127) + 128;
var hex = int.toString(16);
return hex.length === 1 ? "0".concat(hex) : hex;
}
function getRainbowColors() {
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 28;
var colors = new Array(size).fill(undefined);
return colors.map(function (color, idx) {
var red = sinToHex(idx, size, 0 * Math.PI * 2 / 3); // 0 deg
var blue = sinToHex(idx, size, 1 * Math.PI * 2 / 3); // 120 deg
var green = sinToHex(idx, size, 2 * Math.PI * 2 / 3); // 240 deg
color = "#".concat(red).concat(green).concat(blue);
return color;
});
}
export { getRainbowColors };
//# sourceMappingURL=colors.js.map