-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
84 lines (76 loc) · 2.74 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE HTML>
<html>
<head>
<title>Hexadecimal Color Watch by @Megafry</title>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-title" content="HexaWatch">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<meta name="theme-color" content="#175257">
<meta name="description" content="Hexadecimal Color Watch">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:100" rel="stylesheet">
<style>
body {
text-align: center;
background-color: #000;
color: #fff;
margin: 4px;
font-size: 15vw;
font-family: 'Roboto Mono', cursive;
line-height: 50vh;
overflow: hidden;
transition: background-color 0.4s ease-in;
}
#watch {
margin: auto;
opacity: 0.8;
margin-top: 20vh;
}
#by {
position: fixed;
bottom: 0;
right: 0;
display: block;
height: 24px;
padding: 5px 10px;
line-height: 1;
font-size: 13px;
color: #fff;
opacity: 0.2;
text-decoration: none;
}
</style>
</head>
<body id="body">
<div id="watch">
<div class="n"></div>
</div>
<a id="by" href="https://github.com/Megafry" target="_blank" title="visit my github">@Megafry</a>
<script>
function addZeroBefore(v){
return ("0" + v).slice(-2)
}
document.addEventListener('DOMContentLoaded', function() {
var watch = document.getElementById('watch')
function update(){
currentdate = new Date()
hh = addZeroBefore(currentdate.getHours())
mm = addZeroBefore(currentdate.getMinutes())
ss = addZeroBefore(currentdate.getSeconds())
datetime = "#"+ hh +":"+ mm +":"+ ss
color = "#"+ hh +""+ mm +""+ ss
document.body.style.backgroundColor = color
watch.innerHTML = datetime
}
update()
window.setInterval(function(){
update()
}, 1000)
})
</script>
</body>
</html>