RGB

RGB (Red, Green, and Blue) refers to a system for representing the colors to be used on a computer display.


  • RGB colors are also known as “additive color”, because the colors are being added together to achieve further colors or until the outcome is white.
  • This is because our eyes receive no reflected light and they perceive the color to be black.

                                                                                                              RGB colors are Additive
                                                               

HTML color names






Converting RGB to hexadecimal

  • RGB values are usually given in the . 
  • This number divided by sixteen (integer division; ignoring any remainder) gives us the first hexadecimal digit (between 0 and F, where the letters A to F represent the numbers ten to fifteen). 
RGB color code
The RGB color is a combination of Red, Green and Blue colors:
(R, G, B)
The red, green and blue use 8 bits each, which have integer values from 0 to 255.
So the number of colors that can be generated is:
256×256×256 = 16777216 = 100000016
Hex color code
Hex color code is a 6 digits hexadecimal (base 16) number:
RRGGBB16
  • The 2 left digits represent the red color. 
  • The 2 middle digits represent the green color. 
  • The 2 right digits represent the blue color. 
Example #1
Convert red color (255,0,0) to hex color code: R = 25510 = FF16 G = 010 = 0016 B = 010 = 0016 So the hex color code is: Hex = FF0000     Example #2 
Convert gold color (255,215,0) to hex color code:
R = 25510 = FF16 
G = 21510 = D716 
B = 010 = 0016 
So the hex color code is:
Hex = FFD700               

Previous
« Prev Post