# The ColorName interface

The `ColorName` interface provides a standard mapping between color names and linear RGB triples. The implementation recognizes the following names, based on those found in `/usr/lib/X11/rgb.txt`:

AliceBlue | ForestGreen | MintCream | SandyBrown
AntiqueWhite * | Gainsboro | MistyRose * | SeaGreen *
Aquamarine * | GhostWhite | Moccasin | Seashell *
Azure * | Gold * | NavajoWhite * | Sienna *
Beige | Goldenrod * | Navy | SkyBlue *
Bisque | GoldenrodYellow | NavyBlue | SlateBlue *
Black | Gray ** | OldLace | SlateGray *
BlanchedAlmond | Green * | OliveDrab * | SlateGrey
Blue * | GreenYellow | OliveGreen * | Snow *
BlueViolet | Grey ** | Orange * | SpringGreen*
Brown * | Honeydew * | OrangeRed * | SteelBlue *
Burlywood * | HotPink * | Orchid * | Tan *
CadetBlue * | IndianRed * | PapayaWhip | Thistle *
Chartreuse * | Ivory * | PeachPuff * | Tomato *
Chocolate * | Khaki * | Peru | Turquoise *
Coral * | Lavender | Pink * | Violet
CornflowerBlue | LavenderBlush * | Plum * | VioletRed *
Cornsilk * | LawnGreen | Powderblue | Wheat *
Cyan * | LemonChiffon * | Purple * | White
DeepPink * | LimeGreen | Red * | WhiteSmoke
DeepSkyBlue * | Linen | RosyBrown* | Yellow *
DodgerBlue * | Magenta * | Royalblue* | YellowGreen
Firebrick * | Maroon * | SaddleBrown
FloralWhite | MidnightBlue | Salmon *

The star (`*`) indicates that the implementation recognizes a name along with the suffixes `1`-`4`; e.g., `Red`, `Red1`, `Red2`, `Red3`, and `Red4`.

The double star (`**`) indicates that the implementation also recognizes the names with the suffixes `0` through `100`. That is, `Gray0`, `Gray1`, ... , `Gray100`, as well as `Grey0`, `Grey1`, ... , `Grey100`.

In addition, the name of a color `C` from this list can be prefixed by one or more of the following modifiers:

Term | Meaning
`Light` or `Pale` | 1/3 of the way from `C` to white
`Dim` or `Dark` | 1/3 of the way from `C` to black
`Weak`, `Drab`, or `Dull` | 1/3 of the way from `C` to the gray with the same brightness as `C`
`Strong`, `Vivid` or `Bright` | 1/3 of the way from `C` to the purest color with the same hue as `C`
`Reddish` | 1/3 of the way from `C` to red
`Greenish` | 1/3 of the way from `C` to green
`Bluish` | 1/3 of the way from `C` to blue
`Yellowish` | 1/3 of the way from `C` to yellow

Each of these modifiers can be modified in turn by the following prefixes, which replace ``1/3 of the way'' by the indicated fraction:

Term | Degree | % (approx.)
`VeryVerySlightly` | 1/16 of the way | 6%
`VerySlightly` | 1/8 of the way | 13%
`Slightly` | 1/4 of the way | 25%
`Somewhat` | 3/8 of the way | 38%
`Rather` | 1/2 of the way | 50%
`Quite` | 5/8 of the way | 63%
`Very` | 3/4 of the way | 75%
`VeryVery` | 7/8 of the way | 88%
`VeryVeryVery` | 15/16 of the way | 94%

The modifier `Medium` is also recognized as a shorthand for `SlightlyDark`. (But you cannot use `VeryMedium`.)

    INTERFACE ColorName;

    IMPORT Color, TextList;

    EXCEPTION NotFound;

    PROCEDURE ToRGB (name: TEXT): Color.T RAISES {NotFound};

Give the `RGB.T` value described by `name`, ignoring case and whitespace. A cache of unnormalized names is maintained, so this procedure should be pretty fast for repeated lookups of the same name.

    PROCEDURE NameList (): TextList.T;

Return a list of all the ``basic'' (unmodified) color names known to this module, as lower-case `TEXT`s, in alphabetical order.

    END ColorName.