-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (42 loc) · 1.58 KB
/
index.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
let bg = "#343434";
// i-blue,j-pink,k-green-,l-orange,m-purple
let i=0,j=0,cool_switch = document.querySelector(".switch");
let blue="#0275d8",pink="#ff00ff",green="#45e521",orange="#ff6600",l_purple="#d500f9",purple="#7f00ff";
let red="#E23636"
let sky="#00e5ff";
let yellow = "#ffc107";
let colors = [blue,green,yellow,purple,orange,red,pink,l_purple,sky];
let names = ["blue","green","yellow","purple","orange","red","pink","l_purple","sky"];
let math = colors.length;
cool_switch.addEventListener("click",function(){
i=(i+1)%(math*2);
if(i%2==0)
{
if(j<(math-1))
{
let img = 'img/'+names[j+1]+'.png';
console.log(img);
cool_switch.style.background = colors[j+1];
document.querySelector(".head").style.color = colors[j+1];
document.querySelector(".image").style.backgroundImage = `url(${img})`;
}
else
{
let b = 'img/blue.png';
cool_switch.style.background = colors[0];
document.querySelector(".head").style.color = colors[0];
document.querySelector(".image").style.backgroundImage = `url(${b})`;
}
document.querySelector("body").style.background = bg;
j++;
if(j==math)
j=0;
}
else
{
document.querySelector("body").style.background = colors[j];
cool_switch.style.background = bg; document.querySelector(".head").style.color = bg;
document.querySelector(".image").style.backgroundImage = "url('')";
document.querySelector(".image").style.transition = "0.5s ease";
}
});