-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
27 lines (26 loc) · 1.01 KB
/
script.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
//Dark-Lite modes
const mode = document.querySelector('#modeImg');
let val = 1;
//mode switch function
function modeSwitch(){
if (val == 1){
this.src = "sources/moon.png";
document.documentElement.style.setProperty('--bg', 'radial-gradient( #888888, #ffffff)');
document.documentElement.style.setProperty('--color', '#000000');
document.documentElement.style.setProperty('--calc-bg', '(220, 220, 250, .5)');
document.documentElement.style.setProperty('--screen', '#222222');
console.log("switched to lite");
val=2;
return val;
} else{
this.src = "sources/sun.png";
document.documentElement.style.setProperty('--bg', 'radial-gradient(#101010, #050505)');
document.documentElement.style.setProperty('--color', '#ffffff');
document.documentElement.style.setProperty('--calc-bg', '(2, 2, 2, .75)');
document.documentElement.style.setProperty('--screen', '#000000');
console.log("switched to dark");
val=1;
return val;
}
}
mode.addEventListener('click', modeSwitch);