-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (29 loc) · 1.07 KB
/
Copy pathscript.js
File metadata and controls
32 lines (29 loc) · 1.07 KB
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
var red = document.querySelector("#red");
var green = document.querySelector("#green");
var blue = document.querySelector("#blue");
var circle = document.querySelector("#circle");
var btn = document.querySelector("#btn");
var code = document.querySelector("#code");
var pallette = document.querySelector("#pallette");
var save = document.querySelector("#save");
var color = document.querySelector(".color");
var text = document.querySelector("#text");
var currentColor = "rgb(255, 255, 255)";
var palletteColor = "rgb(255, 255, 255)";
btn.addEventListener("click", function () {
currentColor = `rgb(${red.value}, ${green.value}, ${blue.value})`;
circle.style.backgroundColor = currentColor;
circle.style.cursor = "pointer";
code.textContent = currentColor;
});
circle.addEventListener("click", function () {
palletteColor = `rgb(${red.value}, ${green.value}, ${blue.value})`;
pallette.innerHTML += `
<div id="inside">
<div class="color">
<div style="background-color:${palletteColor};" id="save"></div>
<h5 id="text">${palletteColor}</h5>
</div>
</div>
`;
});