-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdark.js
61 lines (54 loc) · 2.35 KB
/
dark.js
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
if(localStorage.getItem("theme") == "dark") {
console.log("Dark before reload")
toDark()
}
function switchMode() {
if(page.style.backgroundColor == 'rgb(24, 24, 24)') {
toLight()
}
else {
toDark()
}
}
function toLight() {
localStorage.setItem("theme","light")
console.log('light')
document.getElementById('page').style.backgroundColor = "#FFFFFF"
document.getElementById('timer').style.backgroundColor = "#FFFFFF"
document.getElementById('restart').style.backgroundColor = "#FFFFFF"
document.getElementById('modal').style.backgroundColor = "#FFFFFF"
document.getElementById('close-button').style.backgroundColor = "#FFFFFF"
document.getElementById('close-button').style.color = "#000000"
document.getElementById('display').style.backgroundColor = "#FFFFFF"
document.getElementById('display').style.color = "#000000"
document.getElementById('enter-text').style.backgroundColor = "#FFFFFF"
document.getElementById('enter-text').style.color = "#000000"
const array = displayElement.querySelectorAll('span')
array.forEach((span) => {
if(span.style.backgroundColor == "#704b02")
span.style.backgroundColor = "#ffac04"
else
span.style.backgroundColor = "#FFFFFF"
})
}
function toDark() {
localStorage.setItem("theme","dark")
console.log('dark')
document.getElementById('page').style.backgroundColor = "#181818"
document.getElementById('timer').style.backgroundColor = "#181818"
document.getElementById('restart').style.backgroundColor = "#181818"
document.getElementById('modal').style.backgroundColor = "#181818"
document.getElementById('close-button').style.backgroundColor = "#181818"
document.getElementById('close-button').style.color = "#FFFFFF"
document.getElementById('display').style.backgroundColor = "#181818"
document.getElementById('display').style.color = "#FFFFFF"
document.getElementById('enter-text').style.backgroundColor = "#181818"
document.getElementById('enter-text').style.color = "#FFFFFF"
const array = displayElement.querySelectorAll('span')
array.forEach((span) => {
if(span.style.backgroundColor == "#ffac04")
span.style.backgroundColor = "#704b02"
else
span.style.backgroundColor = "#181818"
})
}