Specifying colours
Colours can be specified in multiple ways, including as preset names (e.g. blue
), hexadecimal numbers (starting with #), or written as a triple of red, green, and blue values (e.g. rgb(0, 10, 0)
) each in the range from 0 to 255. All these values are equivalent, resulting in the colour white:
white
#FFFFFF
rgb(255, 255, 255)
Red, green, and blue values
Any colour can be viewed as being formed from red, green, and blue light mixed together. The two extremes are black, where there is no light at all (all values 0), and white, where there is a full amount of each kind of light (all values 255). The table below gives some of the predefined names and the amount of each kind of light used for each. If you are not familiar with how colours of light work, you might be surprised by the ways yellow, orange, and pink are formed.
Name | Red | Green | Blue |
---|---|---|---|
black | 0 | 0 | 0 |
white | 255 | 255 | 255 |
red | 255 | 0 | 0 |
green | 0 | 255 | 0 |
blue | 0 | 0 | 255 |
purple | 128 | 0 | 128 |
yellow | 255 | 255 | 0 |
orange | 255 | 128 | 0 |
grey | 128 | 128 | 128 |
pink | 255 | 192 | 203 |
Using the red, green, and blue values directly instead of using preset names allows you to choose colours to which no names have yet been assigned. For example, you could specify a different shade of grey using rgb(100, 100, 100)
.
How can I find other colours to use?
The Help page gives resources where you can learn much more about colours.