Colors may be specified in three ways: 1) RGB triplets, 2) by name, or 3) by HTML notation.
An RGB triplet is a 1x3 vector where each value is between 0 and 1 inclusive.
The first value represents the percentage of Red, the second value the
percentage of Green, and the third value the percentage of Blue. For example,
[1, 0, 1]
represents full Red and Blue channels resulting in the color
magenta.
Eight colors can be specified directly by name or by a single character short name.
Name | Color |
---|---|
‘k’, "black" | blacK |
‘r’, "red" | Red |
‘g’, "green" | Green |
‘b’, "blue" | Blue |
‘y’, "yellow" | Yellow |
‘m’, "magenta" | Magenta |
‘c’, "cyan" | Cyan |
‘w’, "white" | White |
HTML notation is a string that begins with the character ‘#’ and is
followed by either 3 or 6 hexadecimal digits. As with RGB triplets, each
hexadecimal number represents the fraction of the Red, Green, and Blue channels
present in the specified color. For example, "#FF00FF"
represents
the color magenta.