SOURCE

console 命令行工具 X clear

                    
>
console
var clock = document.getElementById("clock");
var hexColor = document.getElementById("hex-color");

function hexClock() {
    var time = new Date ();
    var hours = time.getHours().toString();
    var minutes = time.getMinutes().toString();
    var seconds = time.getSeconds().toString();
    
    if (hours.length < 2){
        hours = "0" + hours;
    }
    
    if (minutes.length < 2) {
        minutes = "0" + minutes;
    }
    
    if(seconds.length < 2) {
        seconds = "0" + seconds;
    }
    
    var clockStr = hours + " : " + minutes + " : " + seconds;
    var hexColorStr = "#" + hours + minutes + seconds;
    
    clock.textContent = clockStr;
    hexColor.textContent = hexColorStr;
    
    document.body.style.backgroundColor = hexColorStr;
}
hexClock();
setInterval(hexClock,1000);
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Clock</title>
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <link  href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">

</head>
<body>
    <h1 id="clock">00 : 00 . 00 </h1>
    <p id="hex-color">#000000</p>
    <script src="app.js"></script>
    </body>
</html>
body
{
    font-family:"lato", sans-serif;;
    margin-top: 200px;
    text-align: center;
    color: white;
    font-weight: 100;
    
}
h1 {
    text-shadow: 0px 0px 12px white;
}

#clock {
    font-weight:100;
    font-size: 100px;
}