JSFiddle - React, Tailwind, and code Playground
JavaScript
function getRandomColor() {
var values = ['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
var hex = '#';
for (var i = 0; i < 6; i++) {
hex += values[Math.floor(Math.random() * values.length)];
}
return hex;
}
console.log(getRandomColor());