forked from Takashi069/Website-Smart-Board
-
Notifications
You must be signed in to change notification settings - Fork 0
/
colorPalette.js
40 lines (36 loc) · 1019 Bytes
/
colorPalette.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
const black = document.getElementById('black');
const grey = document.getElementById('grey');
const red = document.getElementById('red');
const blue = document.getElementById('blue');
const green = document.getElementById('green');
var cpactive = false;
black.addEventListener('click', (e) => {
color = 'black';
console.log("black");
})
grey.addEventListener('click', (e) => {
color = 'grey';
console.log("grey");
})
red.addEventListener('click', (e) => {
color = 'red';
})
blue.addEventListener('click', (e) => {
color = 'blue';
})
green.addEventListener('click', (e) => {
color = 'green';
})
colorEl.addEventListener('click', (e) => {
let cp = document.getElementById("color-palette");
if (cpactive) {
console.log("Palette deactive");
cpactive = false;
cp.hidden = true;
} else {
console.log("Palette active");
cp.hidden = false;
cpactive = true;
document.getElementById("color-palette").style.zIndex = '20';
}
})