RGB Color Generator using JavaScript and HTML/CSS
RGB Colors
RGB color values are supported in all browsers.
An RGB color value is specified with: rgb(red, green, blue).
Each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 255.
For example, rgb(0, 0, 255) is rendered as blue, because the blue parameter is set to its highest value (255) and the others are set to 0.
Main task is to get values of "r" , "g" , "b" from input[type"range"], then call out function getColor() from which will generate the rgb color and change the background color of body.
function getColor() { let rgb = "rgb(" + r + ", " + g + ", " + b + ")"; document.body.style.background = rgb; document.getElementById("color").innerHTML = rgb; }
And this will be a fun simple project for all beginner level JavaScript / HTML / CSS learners.
Comments
Leave a comment
You are not LoggedIn but you can comment as an anonymous user which requires manual approval. For better experience please Login.