UNPKG

@iamsuz/color-kit

Version:

A toolkit to generate random colors and identify color names

16 lines (15 loc) 371 B
"use strict"; /** * This function generatos the Hex Color Code * @returns String */ function generateRandomColor() { //Only these many letters const letters = "0123456789ABCDEF"; let color = "#"; for (let i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } module.exports = { generateRandomColor };