Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <script type="text/javascript">
  2. function updateTextInput() {
  3. var valueHue = document.getElementById('sliderHue').value;
  4. var valueSaturation = document.getElementById('sliderSaturation').value;
  5. var valueLightness = document.getElementById('sliderLightness').value;
  6.  
  7. document.getElementById('textHue').value = valueHue;
  8. document.getElementById('textSaturation').value = valueSaturation + "%";
  9. document.getElementById('textLightness').value = valueLightness + "%";
  10.  
  11. var color = "hsl(" + valueHue + ", " + valueSaturation + "%, " + valueLightness + "%)";
  12. document.getElementById('colorDisplay').setAttribute('style', "background-color:" + color);
  13. }
  14. </script>
  15.  
  16.  
  17. <div>
  18. Hue:
  19. <br>
  20. <input id="sliderHue" type="range" min="0" max="360" step="1" onchange="updateTextInput();">
  21. <br>
  22. <input type="text" id="textHue" value="">
  23. <br>
  24. <br>
  25. <br>Saturation:
  26. <br>
  27. <input id="sliderSaturation" type="range" min="0" max="100" step="1" onchange="updateTextInput();">
  28. <br>
  29. <input type="text" id="textSaturation" value="">
  30. <br>
  31. <br>
  32. <br>Lightness:
  33. <br>
  34. <input id="sliderLightness" type="range" min="0" max="100" step="1" onchange="updateTextInput();">
  35. <br>
  36. <input type="text" id="textLightness" value="">
  37. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement