UNPKG

alecmce-primitivesjs

Version:

A small library for visualizing the prime factor decomposition of numbers.

24 lines (23 loc) 532 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var COLORS = { 2: 'yellow', 3: 'dodgerblue', 5: 'red', 7: 'darkorchid', 11: 'lawngreen', 13: 'limegreen', 17: 'skyblue', 19: 'salmon' }; function getColor(index) { var color = COLORS[index]; if (!color) { COLORS[index] = "rgb(" + random() + "," + random() + "," + random() + ")"; } return color; } exports.getColor = getColor; function random() { return 100 + Math.floor(Math.random() * 156); }