when you only know the values of R, G, and B (in color), how do you put it in your code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

when you only know the values of R, G, and B (in color), how do you put it in your code?

7th Dec 2018, 12:07 AM
Audrey Garcia
Audrey Garcia - avatar
4 Answers
+ 7
Use this format style=color:#00ff00
7th Dec 2018, 4:38 AM
Nathan 🇰🇪
Nathan 🇰🇪 - avatar
+ 2
Which language? I can answer for CSS: https://www.w3schools.com/colors/colors_rgb.asp
7th Dec 2018, 1:50 AM
Janning⭐
Janning⭐ - avatar
+ 2
I wrote a python script that will convert it to hexadecimal. Enter your 3 values and run the script. https://code.sololearn.com/czu7qnKGDXi2/?ref=app
7th Dec 2018, 2:46 AM
LordHill
LordHill - avatar
+ 1
If you know the values of R, G and B in decimal, and yu want to put it in CSS code without knowing how to convert to hexadecimal form (#xxxxxx with x from 0 to 9 or a to f), you could use the rgb form (rgb(r,g,b) with r,g,b from 0 to 255) or even rgba form(rgb and alpha --opacity -- channel rgba(r,g,b,a) with r,g,b from 0 to 255 and a as floating point number from 0 to 1 -- e.g. 0.5 for half-transparency)
7th Dec 2018, 7:29 AM
visph
visph - avatar