<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
html, body {
height: 100%;
}
body {
-webkit-transition: background 1s linear;
-moz-transition: background 1s linear
transition: background 1s linear;
}
</style>
</head>
<body>
<script>
var colors = ['red', 'green', 'blue', 'grey', 'orange'],
i = 0;
setTimeout(function foo() {
document.body.style.background = colors[++i % colors.length];
setTimeout(foo, 2000)
}, 2000)
</script>
</body>
</html>