-
Notifications
You must be signed in to change notification settings - Fork 17
/
app.js
53 lines (38 loc) · 1.36 KB
/
app.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
var theme = document.querySelector("input[name=theme]");
if( localStorage.getItem("dark") !== undefined )
{
if(localStorage.getItem("dark") === "false")
theme.checked = false;
else
theme.checked = true;
}
changeTheme();
theme.addEventListener("change",(e)=>{
changeTheme();
})
function changeTheme(){
let card = document.getElementsByClassName("card");
let cardGroup = document.getElementsByClassName("card-group");
if(theme.checked)
{
for( let i = 0; i < card.length; i++)
card[i].style.color = "white";
for( let i = 0; i < cardGroup.length; i++)
cardGroup[i].style.backgroundColor = "black";
document.getElementById("text").style.color = "white";
document.getElementById("text").style.backgroundColor = "black";
document.getElementById("main").style.backgroundColor = "black";
localStorage.setItem("dark",true);
}
else
{
for( let i = 0; i < card.length; i++)
card[i].style.color = "black";
for( let i = 0; i < cardGroup.length; i++)
cardGroup[i].style.backgroundColor = "white";
document.getElementById("text").style.color = "black";
document.getElementById("text").style.backgroundColor = "white";
document.getElementById("main").style.backgroundColor = "white";
localStorage.setItem("dark",false);
}
}