Generated: January 16, 2003, 23:30:07 | Copyright ©2003, Kurt Nørmark |  |
Reference Manual of the Color Library
Kurt Nørmark © normark@cs.auc.dk Department of Computer Science Aalborg University Denmark
Master index
Source file: lib/color.scm
LAML Version 19.00 (January 16, 2003, full)
| A library which contains the basic of handling colors in LAML.
The library has encoding functions that convert rgb color lists, such as (rgb-color 255 255 255)
and (255 255 255) to a strings, such as "#ffffff". The primary color encoding function is rgb-color-encoding.
The primary color representation function is make-rgb-color, which is accompanied by the color predicate rgb-color?
a the color selectors red-of-rgb-color, green-of-rgb-color, and blue-of-rgb-color.
Of historical reasons we support two representation of colors. The first - the old representation - is just a list of red, green,
blue numbers (positive integers between 0 and 255), such as (255 0 255).
The other is a tagged list of red, green, blue values such as (rgb-color 255 0 255), where rgb-color is the tag symbol.
Please be aware of the two different representations when you use this library.
The library also contains a set of color constants, all bound to the old color format (of backward compatibility reasons).
|
|
Table of Contents:
Alphabetic index:
| aqua | aqua | A color constant. | black | black | A color constant. | blue | blue | A color constant. | blue-of-rgb-color | (blue-of-rgb-color color) | Return the blue constituent of the color. | blue1 | blue1 | A color constant. | blue2 | blue2 | A color constant. | blue3 | blue3 | A color constant. | brown | brown | A color constant. | dark-red | dark-red | A color constant. | dark-yellow | dark-yellow | A color constant. | fuchsia | fuchsia | A color constant. | green | green | A color constant. | green-of-rgb-color | (green-of-rgb-color color) | Return the green constituent of the color. | green1 | green1 | A color constant. | green2 | green2 | A color constant. | grey | grey | A color constant. | grey1 | grey1 | A color constant. | grey2 | grey2 | A color constant. | light-blue | light-blue | A color constant. | lime | lime | A color constant. | make-color | (make-color r g b) | Make and return the rgb-list representation of the color with r red, g green, and b blue. | make-rgb-color | (make-rgb-color r g b) | Make and return a color represented by a red, green and blue constituent. | maroon | maroon | A color constant. | navy | navy | A color constant. | olive | olive | A color constant. | orange | orange | A color constant. | purple | purple | A color constant. | red | red | A color constant. | red-of-rgb-color | (red-of-rgb-color color) | Return the red constituent of the LAML color. | rgb-color | (rgb-color r g b) | Return an 'Internet color string" encoding the colors r, g, and b. | rgb-color-encoding | (rgb-color-encoding . color-pars) | Return a color encoding (a string of length seven such as "#123456") of color-pars. | rgb-color-list | (rgb-color-list color-triple-list) | Returns the color encoding of (list r g b) given a list of three color numbers as parameter. | rgb-color? | (rgb-color? x) | Is x a LAML color
| silver | silver | A color constant. | tetal | tetal | A color constant. | white | white | A color constant. | yellow | yellow | A color constant. |
|
1. PRIMARY COLOR ENCODING FUNCTION.
The function in this section, rgb-color-encoding, accepts a variety of different color formats as input.
It returns a string of length seven, such as "#ff00ff". The output format is the primary color representation in most web contexts.
rgb-color-encoding
| Form | | (rgb-color-encoding . color-pars) |
|
| Description | | Return a color encoding (a string of length seven such as "#123456") of color-pars.
The color-pars parameter(s) to this function are very versatile.
If it is a color encoding string already, just return it.
If it is a color value which satisfies the predicate rgb-color?, return the encoding of this value.
If it is a symbol, return the color encoding bound to it.
If it is a string, transform it to a symbol and return the color encoding bound to it.
If it is a list like (list 1 2 3), consider it as a red-green-blue list, and return the color encoding of it.
If it is three individiual parameters, say r, g, and b, return the color encoding of red r, green g, and blue b.
If you care about efficiency, use can consider to use the function rgb-string instead of rgb-color-encoding. |
|
| Returns | | A string of length 7 of the format "#rrggbb". |
|
| Example | | (rgb-color-encoding "red") |
|
| Example | | (rgb-color-encoding 255 0 0) |
|
| Example | | (rgb-color-encoding (make-rgb-color 255 0 0)) |
|
| Example | | (rgb-color-encoding '(255 0 0)) |
|
| Example | | (rgb-color-encoding (make-color 255 0 0)) |
|
| Example | | (rgb-color-encoding "#ff0000") |
|
| Example | | (rgb-color-encoding 'red) |
|
2. SECONDARY COLOR ENCODING FUNCTIONS.
The functions in this section only work with the old version of the color representation.
This is the untagged list representation, such as '(255 0 0).
For new development, the function
make-rgb-color should be used together with the color encoding function rgb-color-encoding.
rgb-color
| Description | | Return an 'Internet color string" encoding the colors r, g, and b. |
|
| Parameters | | r | | The amount of red - a decimal number between 0 and 255. | g | | The amount of green - a decimal number between 0 and 255. | b | | The amount of blue - a decimal number between 0 and 255. |
|
| Returns | | A string of length 7 of the form "#rrggbb". |
|
rgb-color-list
| Form | | (rgb-color-list color-triple-list) |
|
| Description | | Returns the color encoding of (list r g b) given a list of three color numbers as parameter. |
|
| Parameters | | color-triple-list | | A list of length 3. Each element of the list is a decimal integer between 0 and 255. |
|
| Returns | | A string of length 7 of the form "#rrggbb". |
|
3. COLOR CONSTRUCTOR, PREDICATE, AND SELECTORS.
The function make-rgb-color is the primary color constructor in LAML-based software.
The predidate and the selectors only work with make-rgb-color.
The function make-color is an old version of the constructor.
make-rgb-color
| Description | | Make and return a color represented by a red, green and blue constituent.
This is the primary color constructor of LAML-based software. |
|
| Parameters | | r | | The amount of red - a decimal number between 0 and 255. | g | | The amount of green - a decimal number between 0 and 255. | b | | The amount of blue - a decimal number between 0 and 255. |
|
| Returns | | A tagged list of color numbers. |
|
| Example | | (rgb-color-encoding (make-rgb-color 255 0 0)) => "#ff0000" |
|
| Example | | (make-rgb-color 255 0 0) => (rgb-color 255 0 0) |
|
rgb-color?
red-of-rgb-color
| Description | | Return the red constituent of the LAML color. |
|
| Parameters | | color | | A color constructed with make-rgb-color. |
|
green-of-rgb-color
| Form | | (green-of-rgb-color color) |
|
| Description | | Return the green constituent of the color. |
|
| Parameters | | color | | A color constructed with make-rgb-color. |
|
blue-of-rgb-color
| Form | | (blue-of-rgb-color color) |
|
| Description | | Return the blue constituent of the color. |
|
| Parameters | | color | | A color constructed with make-rgb-color. |
|
make-color
| Description | | Make and return the rgb-list representation of the color with r red, g green, and b blue.
This is an old version of the color contructor. |
|
| Note | | Deprecated. Use make-rgb-color. |
|
4. COLOR CONSTANTS.
To stay backward compatible with a substantial amount of older LAML software, all color constants
are bound to the old LAML color representation. Thus, for instance, the value of red is (255 0 0), and not
(rgb-color 255 0 0). As an important observation, the primary color encoding function, rgb-color-encoding, accepts
the value of the color constants as input (besides a number of other kinds of input).
red
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
dark-red
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
green
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
green1
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
green2
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
blue
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
white
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
black
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
yellow
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
purple
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
light-blue
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
blue1
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
blue2
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
blue3
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
orange
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
dark-yellow
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
grey1
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
grey2
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
brown
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
maroon
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
grey
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
silver
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
tetal
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
aqua
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
A color constant. A color is represented as a list of integers of length three (rgb).
|
|
lime
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
A color constant. A color is represented as a list of integers of length three (rgb).
|
|
olive
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
navy
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
fuchsia
| Description | | A color constant. A color is represented as a list of integers of length three (rgb).
|
|
Generated: January 16, 2003, 23:30:08
This documentation has been extracted automatically from the Scheme source file by means of the Schemedoc tool