JSFiddle - React, Tailwind, and code Playground

by Manuel Rojas

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/latest/jquery.js"></script>
<div class="myDiv"></div>

CSS

div {
    width: 100px;
    height: 100px;
}

JavaScript

var colors = ['rgb(118,57,27)', 'rgb(229,59,47)', 'rgb(118,57,27)', 'rgb(118,57,27)'];

myDiv.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
for(var i = 0; i < 4; i++)
    rgb.push(Math.floor(Math.random() * 255));

document.getElementById('myDiv').style.backgroundColor = 'rgb('+ rgb.join(',') + ')';