After trying numerous methods, I found the process to be quite simple except for one issue that has been stumping me. While the background color changing automatically works well, it transitions too quickly. I am now wondering if there is a solution to slow down the transition as it currently happens abruptly and is not very user-friendly.
<script>
$("body").css("transition","all 3s");
var colors = ["#c11733","#c0392b","#66cc99","#27ae60","#745380"];
function changeBgColor(){
$("body").css({
backgroundColor : colors[parseInt(Math.random() * 3)]
});
}
//changeBgColor();
setInterval(changeBgColor, 3000);
</script>