Fixed slider color gradient

This commit is contained in:
Kai Lauterbach 2023-05-10 13:35:29 +02:00
parent 8faa653826
commit 6c3e607720
2 changed files with 8 additions and 8 deletions

View file

@ -30,16 +30,16 @@ var slider = document.getElementById("bri{{LIGHT_NUMBER_DEC}}");
var pwm = document.getElementById("light{{LIGHT_NUMBER_DEC}}_pwm"); var pwm = document.getElementById("light{{LIGHT_NUMBER_DEC}}_pwm");
if (lightNumber === 1) { if (lightNumber === 1) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(31, 119, 180) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(31, 119, 180) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(31, 119, 180) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(31, 119, 180) + ")";
} else if (lightNumber === 2) { } else if (lightNumber === 2) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(255, 127, 14) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(255, 127, 14) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(255, 127, 14) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(255, 127, 14) + ")";
} else if (lightNumber === 3) { } else if (lightNumber === 3) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(44, 160, 44) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(44, 160, 44) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(44, 160, 44) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(44, 160, 44) + ")";
} else if (lightNumber === 4) { } else if (lightNumber === 4) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(214, 39, 40) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(214, 39, 40) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(214, 39, 40) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(214, 39, 40) + ")";
} }
</script> </script>
</div> </div>

View file

@ -31,16 +31,16 @@
var pwm = document.getElementById("light{{LIGHT_NUMBER_DEC}}_pwm"); var pwm = document.getElementById("light{{LIGHT_NUMBER_DEC}}_pwm");
if (lightNumber === 1) { if (lightNumber === 1) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(31, 119, 180) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(31, 119, 180) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(31, 119, 180) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(31, 119, 180) + ")";
} else if (lightNumber === 2) { } else if (lightNumber === 2) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(255, 127, 14) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(255, 127, 14) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(255, 127, 14) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(255, 127, 14) + ")";
} else if (lightNumber === 3) { } else if (lightNumber === 3) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(44, 160, 44) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(44, 160, 44) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(44, 160, 44) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(44, 160, 44) + ")";
} else if (lightNumber === 4) { } else if (lightNumber === 4) {
slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(214, 39, 40) + ", white)"; slider.style.background = "linear-gradient(to bottom, " + rgb2Hex(214, 39, 40) + ", white)";
pwm.style.background = "linear-gradient(to right, " + rgb2Hex(214, 39, 40) + ", white)"; pwm.style.background = "linear-gradient(to right, white, " + rgb2Hex(214, 39, 40) + ")";
} }
</script> </script>
</div> </div>