JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<p>Click Outside after selecting the color</p>
<input type="color" onchange="onColorChange(event)">
</div>
CSS
#background{
width: 100%;
height: 50px;
}
JavaScript
const body = document.querySelector('body');
function onColorChange(event){
body.style.backgroundColor= event.target.value;
}