-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
22 lines (18 loc) · 786 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const colorPreview = document.querySelector(".preview");
const colorSlider = document.getElementById('hue-slider');
const brightnessSlider = document.getElementById('brightness-slider');
const contrastSlider = document.getElementById('contrast-slider');
colorSlider.addEventListener("input", function() {
const hue = this.value;
const color = `hsl(${hue}, 100%, 50%)`;
colorPreview.style.backgroundColor = color;
colorPreview.style.boxShadow = `0px 0px 53px 13px ${color}`;
})
brightnessSlider.addEventListener("input", function() {
const brightness = this.value;
colorPreview.style.filter = `brightness(${brightness}%)`;
})
contrastSlider.addEventListener("input", function() {
const contrast = this.value;
colorPreview.style.filter = `contrast(${contrast}%)`;
})