'use strict'; const colors = [ '#F44336', '#2196F3', '#4CAF50', '#F9A825', '#E91E63', '#00838F' ].map(color => color.match(/[A-F0-9]{2}/g).map( component => parseInt(component, 16) )); /** * Get a random whole number * * @param {number} min Minimal value for the number * @param {number} max Maximal value for the number (excluded) * @return {number} Random number */ export const getRandomNumber = (min, max) => Math.floor(Math.random() * (max - min)) + min; /** * Get a color at given index. For any given * index, the same color will always be returned * * @param {number} index Color index * @return {Array} RGB components */ export const getColor = index => colors[index % colors.length];