Common Graphics : Specifying colors : Specifying colors by name

Specifying colors by name
Common Graphics provides a selection of predefined named colors. The RGB values of these colors are stored in an internal database and can be referenced by name at any time by an application. A subset of these named colors is listed in the following table:
Table 21. A subset of the predefined named colors
The RGB values of a named color can be looked up in the color database by sending the lookupColor: message to a CgScreen. The method is passed the color name to look up. The result is the corresponding CgRGBColor, if the color name was found in the database, or nil if the name was not found.
| color |
color := CgScreen default lookupColor: 'orange'.
Transcript cr; show: color printString.
This code prints a string such as aCgRGBColor(16rFFFF, 16rA5A5, 16r0000) on the Transcript Window. The actual values can differ, depending on the platform.