HTML Colors
In HTML, a colour can be specified by using a colour name, an
RGB value, or a HEX value.
Colour Names
In HTML, a colour can be specified by using a colour name:
Example
Colour Name
Red
Orange
Yellow
Cyan
Blue
»
HTML supports 140 standard colour names.
RGB Value
In HTML, a colour can also be specified as an RGB value,
using this formula: rgb(red, green, blue)
Each parameter (red, green, and blue) defines the intensity
of the colour between 0 and 255.
For example, rgb(255,0,0) is displayed as red, because red is
set to its highest value (255) and the others are set to 0.
To display the colour black, all colour parameters must be
set to 0, like this: rgb(0,0,0).
To display the colour white, all colour parameters must be
set to 255, like this: rgb(255,255,255).
Experiment by mixing the RGB values below:
Red Green Blue
255 0 0
rgb(255, 0, 0)
Example
Colour RGB
rgb(255,0,0)
rgb(255,255,0)
rgb(0,255,0)
rgb(0,255,255)
rgb(0,0,255)
»
Shades of gray are often defined using equal values for all
the 3 light sources:
Example
Colour RGB
rgb(0,0,0)
rgb(90,90,90)
rgb(128,128,128)
rgb(200,200,200)
rgb(255,255,255)
»
HEX Value
In HTML, a colour can also be specified using a hexadecimal
value in the form: #RRGGBB, where RR (red),
GG (green) and BB (blue) are hexadecimal values between 00 and FF (same as
decimal 0-255).
For example, #FF0000 is
displayed as red, because red is set to its highest value (FF) and the others
are set to the lowest value (00).
Example
Colour HEX
#FF0000
#FFFF00
#00FF00
#00FFFF
#0000FF
»
Shades of gray are often defined using equal values for all
the 3 light sources:
Example
Colour HEX
#000000
#404040
#808080
0 comments: