-
Notifications
You must be signed in to change notification settings - Fork 0
/
mode.js
34 lines (31 loc) · 1.41 KB
/
mode.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
darkMode = localStorage["revision-darkMode"] == "true"
if(darkMode == undefined){
darkMode = false
localStorage["revision-darkMode"] = darkMode
}
function loadMode(){
if(darkMode){
document.documentElement.style.setProperty("--mode-bg","#111111")
document.documentElement.style.setProperty("--mode-text","white")
document.getElementById("darkMode").src = "https://retrocoder13.github.io/revision/sun.svg"
document.getElementById("darkMode").style.filter = "invert(1)"
document.getElementById("loading").style.filter = "invert(1)"
if(document.getElementById("accountIcon").src.includes("account.svg")){
document.getElementById("accountIcon").style.filter = "invert(1)"
}
} else {
document.documentElement.style.setProperty("--mode-bg","#FFFFFF")
document.documentElement.style.setProperty("--mode-text","black")
document.getElementById("darkMode").src = "https://retrocoder13.github.io/revision/moon.svg"
document.getElementById("darkMode").style.filter = "invert(0)"
document.getElementById("loading").style.filter = "invert(0)"
if(document.getElementById("accountIcon").src.includes("account.svg")){
document.getElementById("accountIcon").style.filter = "invert(0)"
}
}
}
function changeMode(){
darkMode = !darkMode
loadMode()
localStorage["revision-darkMode"] = darkMode
}