<html> <head> <style> body{ transition: 2s; } </style> </head> <body> <script> (bgc =()=> { document.body.style.backgroundColor= '#'+Math.random().toString(16).slice(2,8); setTimeout(bgc, 2000); })(); </script> </body> </html>