Key Up (Branch 4428)
✨ elzaphaN TV
<html> <head> <title>Let's Start </title> <style> :root{ --h: 180; --l: 50%; } body{ background:hsl(var(--h), 100%, var(--l)); } </style> </head> <body> <script type="text/javascript"> let color = 180; let light = 50; let bg = document.querySelector("body"); document.body.onkeyup = function(e){ if(e.key == "ArrowLeft" && color-10 >= 0){ color -= 10; bg.style.setProperty("--h", color); } else if(e.key == "ArrowRight" && color+10 <= 360){ color += 10; bg.style.setProperty("--h", color); } else if(e.key == "ArrowUp" && light+10 <= 100){ light += 10; bg.style.setProperty("--l", light + '%'); } else if(e.key == "ArrowDown" && light-10 >= 0){ light -= 10; bg.style.setProperty("--l", light + '%'); } } </script> </body> </html>