-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (48 loc) · 1.37 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Time in Color</title>
<link href='https://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
<style>
#time {
position: fixed;
top: 50%;
left: 50%;
font-size: 7.5rem;
font-family: 'Lato', sans-serif;
font-weight: 100;
color: #fff;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div id="time"></div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
function refreshData() {
var date = new Date()
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
if (hours <= 9) {
hours = '0' + hours;
};
if (minutes <= 9) {
minutes = '0' + minutes;
};
if (seconds <= 9) {
seconds = '0' + seconds;
};
var backgroundColor = '#' + hours + minutes + seconds;
$("body").css("background-color", backgroundColor);
$("#time").text(hours + ':' + minutes + ':' + seconds);
setTimeout(refreshData, 1000);
}
refreshData();
</script>
</body>
</html>