RGB Color Space
RGB color space or RGB color system constructs all the colors from the combination of the Red, Green, and Blue colors.
The red, green, and blue use 8 bits each, which have integer values from 0 to 255. This makes 256*256*256 = 16,777,216 possible colors.
RGB ≡ Red, Green, Blue
Each pixel in an LED monitor displays colors using a combination of red, green, and blue LEDs (light-emitting diodes).
When the red pixel is set to 0, the LED is turned off. When the red pixel is set to 255, the LED is fully on.
Any value between them sets the LED to partial light emission.
RGB color format & calculation
RGB code has a 24-bit format (bits 0..23):RED[7:0] GREEN[7:0] BLUE[7:0]
RGB = (R*65536) + (G*256) + B, where R is RED, G is GREEN, and B is BLUE.
Calculation Examples:
- White RGB Color:RGB code = 255*65536 + 255*256 + 255 = #FFFFFF
- Blue RGB Color:RGB code = 0*65536 + 0*256 + 255 = #0000FF
- Red RGB Color:RGB code = 255*65536 + 0*256 + 0 = #FF0000
- Green RGB Color:RGB code = 0*65536 + 255*256 + 0 = #00FF00
- Gray RGB Color:RGB code = 128*65536 + 128*256 + 128 = #808080
- Yellow RGB Color:RGB code = 255*65536 + 255*256 + 0 = #FFFF00
Basic colors:
Color | HTML / CSS Name | Hex Code | Decimal Code (R, G, B) |
---|---|---|---|
Black | #000000 | (0, 0, 0) | |
White | #FFFFFF | (255, 255, 255) | |
Red | #FF0000 | (255, 0, 0) | |
Lime | #00FF00 | (0, 255, 0) | |
Blue | #0000FF | (0, 0, 255) | |
Yellow | #FFFF00 | (255, 255, 0) | |
Cyan / Aqua | #00FFFF | (0, 255, 255) | |
Magenta / Fuchsia | #FF00FF | (255, 0, 255) | |
Silver | #C0C0C0 | (192, 192, 192) | |
Gray | #808080 | (128, 128, 128) | |
Maroon | #800000 | (128, 0, 0) | |
Olive | #808000 | (128, 128, 0) | |
Green | #008000 | (0, 128, 0) | |
Purple | #800080 | (128, 0, 128) | |
Teal | #008080 | (0, 128, 128) | |
Navy | #000080 | (0, 0, 128) |
Additional Colors:
Color | HTML / CSS Name | Hex Code | Decimal Code (R, G, B) |
---|---|---|---|
Maroon | #800000 | (128, 0, 0) | |
Dark Red | #8B0000 | (139, 0, 0) | |
Brown | #A52A2A | (165, 42, 42) | |
Firebrick | #B22222 | (178, 34, 34) | |
Crimson | #DC143C | (220, 20, 60) | |
Red | #FF0000 | (255, 0, 0) | |
Tomato | #FF6347 | (255, 99, 71) | |
Coral | #FF7F50 | (255, 127, 80) | |
Indian Red | #CD5C5C | (205, 92, 92) | |
Light Coral | #F08080 | (240, 128, 128) | |
Dark Salmon | #E9967A | (233, 150, 122) | |
Salmon | #FA8072 | (250, 128, 114) | |
Light Salmon | #FFA07A | (255, 160, 122) | |
Orange Red | #FF4500 | (255, 69, 0) | |
Dark Orange | #FF8C00 | (255, 140, 0) | |
Orange | #FFA500 | (255, 165, 0) | |
Gold | #FFD700 | (255, 215, 0) |