Next: , Previous: , Up: Color   [Contents][Index]


5.11.6 Color Names

(require 'color-names)

Rather than ballast the color dictionaries with numbered grays, file->color-dictionary discards them. They are provided through the grey procedure:

Function: grey k

Returns (inexact->exact (round (* k 2.55))), the X11 color grey<k>.

A color dictionary is a database table relating canonical color-names to color-strings (see External Representation).

The column names in a color dictionary are unimportant; the first field is the key, and the second is the color-string.

Function: color-name:canonicalize name

Returns a downcased copy of the string or symbol name with ‘_’, ‘-’, and whitespace removed.

Function: color-name->color name table1 table2 …

table1, table2, … must be color-dictionary tables. color-name->color searches for the canonical form of name in table1, table2, … in order; returning the color-string of the first matching record; #f otherwise.

Function: color-dictionaries->lookup table1 table2 …

table1, table2, … must be color-dictionary tables. color-dictionaries->lookup returns a procedure which searches for the canonical form of its string argument in table1, table2, …; returning the color-string of the first matching record; and #f otherwise.

Function: color-dictionary name rdb base-table-type

rdb must be a string naming a relational database file; and the symbol name a table therein. The database will be opened as base-table-type. color-dictionary returns the read-only table name in database name if it exists; #f otherwise.

Function: color-dictionary name rdb

rdb must be an open relational database or a string naming a relational database file; and the symbol name a table therein. color-dictionary returns the read-only table name in database name if it exists; #f otherwise.

Function: load-color-dictionary name rdb base-table-type
Function: load-color-dictionary name rdb

rdb must be a string naming a relational database file; and the symbol name a table therein. If the symbol base-table-type is provided, the database will be opened as base-table-type. load-color-dictionary creates a top-level definition of the symbol name to a lookup procedure for the color dictionary name in rdb.

The value returned by load-color-dictionary is unspecified.

Dictionary Creation

(require 'color-database)

Function: file->color-dictionary file table-name rdb base-table-type
Function: file->color-dictionary file table-name rdb

rdb must be an open relational database or a string naming a relational database file, table-name a symbol, and the string file must name an existing file with colornames and their corresponding xRGB (6-digit hex) values. file->color-dictionary creates a table table-name in rdb and enters the associations found in file into it.

Function: url->color-dictionary url table-name rdb base-table-type
Function: url->color-dictionary url table-name rdb

rdb must be an open relational database or a string naming a relational database file and table-name a symbol. url->color-dictionary retrieves the resource named by the string url using the wget program; then calls file->color-dictionary to enter its associations in table-name in url.

This section has detailed the procedures for creating and loading color dictionaries. So where are the dictionaries to load?

http://people.csail.mit.edu/jaffer/Color/Dictionaries.html

Describes and evaluates several color-name dictionaries on the web. The following procedure creates a database containing two of these dictionaries.

Function: make-slib-color-name-db

Creates an alist-table relational database in library-vicinity containing the Resene and saturate color-name dictionaries.

If the files resenecolours.txt, nbs-iscc.txt, and saturate.txt exist in the library-vicinity, then they used as the source of color-name data. Otherwise, make-slib-color-name-db calls url->color-dictionary with the URLs of appropriate source files.

The Short List

(require 'saturate)

Function: saturate name

Looks for name among the 19 saturated colors from Approximate Colors on CIE Chromaticity Diagram:

reddish orangeorangeyellowish orangeyellow
greenish yellowyellow greenyellowish greengreen
bluish greenblue greengreenish blueblue
purplish bluebluish purplepurplereddish purple
red purplepurplish redred

(http://people.csail.mit.edu/jaffer/Color/saturate.pdf). If name is found, the corresponding color is returned. Otherwise #f is returned. Use saturate only for light source colors.

Resene Paints Limited, New Zealand’s largest privately-owned and operated paint manufacturing company, has generously made their Resene RGB Values List available.

(require 'resene)

Function: resene name

Looks for name among the 1300 entries in the Resene color-name dictionary (http://people.csail.mit.edu/jaffer/Color/resene.pdf). If name is found, the corresponding color is returned. Otherwise #f is returned. The Resene RGB Values List is an excellent source for surface colors.

If you include the Resene RGB Values List in binary form in a program, then you must include its license with your program:

Resene RGB Values List
For further information refer to http://www.resene.co.nz
Copyright Resene Paints Ltd 2001

Permission to copy this dictionary, to modify it, to redistribute it, to distribute modified versions, and to use it for any purpose is granted, subject to the following restrictions and understandings.

  1. Any text copy made of this dictionary must include this copyright notice in full.
  2. Any redistribution in binary form must reproduce this copyright notice in the documentation or other materials provided with the distribution.
  3. Resene Paints Ltd makes no warranty or representation that this dictionary is error-free, and is under no obligation to provide any services, by way of maintenance, update, or otherwise.
  4. There shall be no use of the name of Resene or Resene Paints Ltd in any advertising, promotional, or sales literature without prior written consent in each case.
  5. These RGB colour formulations may not be used to the detriment of Resene Paints Ltd.

Next: , Previous: , Up: Color   [Contents][Index]