How do I store a variable value in a rgb() ? I use this code which isn't working:
<script>
var R=200;
var colval="rgb(R,10,100)";
</script>
I want it to be like this:
<script>
var colval="rgb(200,10,100)";
</script>
but somehow it doesn't store R right , putting quotes around 200 or R isn't working either.
Update the enum, and all of the places you've used Color. Blue will update. To get the long value of the RGB value to store, I just threw the value into the Immediate window and copied the output. The output will be 14390640.
RGB Color Values Each parameter (red, green, and blue) defines the intensity of the color with a value between 0 and 255. This means that there are 256 x 256 x 256 = 16777216 possible colors!
The format of the RGB Value The format of an RGB value in the functional notation is 'rgb(' followed by a comma-separated list of three numerical values (three integer values(0-255, 0-255, 0-255)) followed by ')'.
RGB defines the values of red (the first number), green (the second number), or blue (the third number). The number 0 signifies no representation of the color and 255 signifies the highest possible concentration of the color.
I assume you're using JavaScript:
<script>
var R = 200;
var colval = "rgb(" + R + ",10,100)";
</script>
Results in colval = rgb(200,10,100)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With