RGB stands for three color components, namely red, green and blue. In HTML, we can specify the color for an element in its style attribute using the RGB value.
Below is an RGB color generator. Set different values for red, green and blue to generate a new color.
Red
Green
Blue
The first parameter sets the intensity of the red color.
The second parameter sets the intensity of the green color, and the third parameter sets the intensity of the blue color light source.
The intensity for each parameter can be set from 0 to 255. i.e. a total of 256 unique levels can be set for each color.
The red color on the web screen is displayed by rgb(255, 0, 0).
It means the intensity for the red color light source is set to high and the intensity for green and blue color is set to 0.
Similarly, when you need to display the blue color on a web page, specify the color value as rgb(0, 255, 0).
A blue color can be specified using the RGB value rgb(0, 0, 255).
By trying different combinations of intensities for each color in the RGB value, we can display a total of 16777216 (=256 * 256 * 256) colors on the web page.
Setting every parameter to 0 in the RGB value produces black color.
It means you need to set color intensities for red, green and blue to 0.
Setting every parameter to the highest value (255), the browser produces color for the white.
The equal value of all three parameters produces a gray color.
By trying different combinations of equal values, shades of gray color can be produced.
RGBA is an extension of RGB color values.
An extra parameter called Alpha Channel is provided in the value which sets the opacity for a color.
In HTML, the name of the color can be provided using the RGBA value as follows:
Here the fourth parameter is for color transparency. Its value can be set between 0.0 and 1.0.
The value 0 indicates that the color is fully transparent.
The value 1 indicates that the color is not transparent at all.
Below is an RGBA color generator. Set different values for red, green, blue and alpha to generate a new color.
Red
Green
Blue
Alpha
1. HTML Tutorial |
2. Introduction to HTML |
3. Basic HTML Page |
4. HTML Editors |
5. Web Browser |
6. HTML History |
7. Basic HTML Tags |
8. HTML Elements |
9. HTML Attributes |
10. HTML Headings |
11. HTML Paragraphs |
12. HTML Text Formatting |
13. HTML Styles |
14. HTML Comment |
15. HTML Quotation |
16. HTML Colors |
17. HTML RGB Colors |
18. HTML HEX Colors |
19. HTML HSL Color |
20. HTML CSS |
21. HTML Links |
22. HTML Link Colors |
23. Link within Page |
24. HTML Images |
25. HTML Background Image |
26. HTML Image Map |
27. HTML Picture Element |
28. HTML Favicon |
29. HTML Table |
30. HTML Table Border |
31. HTML Table Size |