JSFiddle - React, Tailwind, and code Playground

HTML

<div id='time'>
</div>

CSS

#time{
    height:400px;
    width:400px;
}

JavaScript

var d = new Date();
var time = d.getHours();
var div=document.getElementById('time');
if (time < 12) 
{
    div.style.backgroundColor ='yellow';
}
if (time >= 12 && time < 3) 
{
    div.style.backgroundColor ='red';
}
if (time > 3) 
{
   div.style.backgroundImage  ="url('http://a1.dspncdn.com/media/692x/da/dc/4e/dadc4ed5117d4a8cc582199bb3ac9c68.jpg')";
}