Next: , Previous: Fonts and Markers, Up: Appendices


Appendix B Specifying Colors by Name

The GNU libplot library allows colors to be specified by the user. It includes the bgcolorname, pencolorname, and fillcolorname functions, each of which takes a color as an argument.

The command-line graphics programs built on libplot, namely graph, plot, pic2plot, tek2plot, and plotfont, allow colors to be specified on the command line. Each of them supports a ‘--bg-color’ option, and each of them, other than graph, supports a ‘--pen-color’ option. (graph supports a more complicated ‘--pen-colors’ option, and a ‘--frame-color’ option.)

In any of these contexts, a color may be specified precisely as a hexadecimal string that gives by its 48-bit RGB representation. For example, "#c0c0c0" is a silvery gray, and "#ffffff" is white. Also, colors may be specified by name. 665 distinct names are recognized, including familiar ones like "red", "green", and "blue", and obscure ones like "dark magenta", "forest green", and "olive drab". Color names are case-insensitive, and spaces are ignored. So, for example, "RosyBrown" is equivalent to "rosy brown", and "DarkGoldenrod3" to "dark goldenrod 3".

The file colors.txt, which is distributed along with the GNU plotting utilities, lists the 665 recognized color names. On most systems it is installed in /usr/share/libplot or /usr/local/share/libplot. The names are essentially those recognized by recent releases of the X Window System, which on most machines are listed in the file /usr/lib/X11/rgb.txt. However, for every color name containing the string "gray", a version containing "grey" has been included. For example, both "dark slate gray 4" and "dark slate grey 4" are recognized color names.