Generated: June 1, 2002, 16:56:02Copyright ©2002, Kurt NørmarkThe local LAML software home page

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 17.10 (June 1, 2002) full

A library which contains the basis of handling colors in LAML. In particular it can convert decimal color numbers to the hexidecial representation, which forms the backbone of the color representation in HTML.

The library has encoding functions that convert rgb color lists, such as (list 'rgb-color 255 255 255) and (list 255 255 255) to a strings, such as "#ffffff". The primary color encoding function is rgb-color-encoding.

Of historical reasons we support two representation of colors. The first is just a list of red, green, blue values. The other is a tagged list of red, green, blue values. Please be aware of the two different representations when you use this library.

The library also contains a set of color constants.

Table of Contents:
1. Primary color encoding function.3. Color constructor, predicate, and selectors.5. Number converting.
2. Secondary color encoding functions.4. Color constants.

Alphabetic index:
aquaaquaA color constant.
blackblackA color constant.
blueblueA color constant.
blue-of-rgb-color(blue-of-rgb-color color)Return the blue constituent of the color.
blue1blue1A color constant.
blue2blue2A color constant.
blue3blue3A color constant.
brownbrownA color constant.
dark-reddark-redA color constant.
dark-yellowdark-yellowA color constant.
fuchsiafuchsiaA color constant.
greengreenA color constant.
green-of-rgb-color(green-of-rgb-color color)Return the green constituent of the color.
green1green1A color constant.
green2green2A color constant.
greygreyA color constant.
grey1grey1A color constant.
grey2grey2A color constant.
light-bluelight-blueA color constant.
limelimeA 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.
maroonmaroonA color constant.
navynavyA color constant.
number-in-base(number-in-base n base)Return the decimal number n in base.
oliveoliveA color constant.
orangeorangeA color constant.
purplepurpleA color constant.
redredA color constant.
red-of-rgb-color(red-of-rgb-color color)Return the red constituent of the color.
rgb(rgb r g b)Return an 'Internet list' encoding the color (list r g b).
rgb-color(rgb-color r g b)Returns the color encoding of (list r g b) given three numbers a parameters.
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 color
rgb-string(rgb-string r g b)Return an 'Internet' string encoding the color (list r g b).
rgb-string-list(rgb-string-list color-list)A variant of rgb-string, in which the colors are passed in one list.
silversilverA color constant.
tetaltetalA color constant.
whitewhiteA color constant.
yellowyellowA color constant.

 

1.   PRIMARY COLOR ENCODING FUNCTION.
The function in this section works with both the new and the old way or representing colors. I.e, both with a color like '(255 0 0) which is the old way, and '(rgb-color 255 0 0), which is the new way.


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. This function works with both the new and old representation of colors. The color-pars parameter(s) to this function is 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 should probably use one of functions in the next section.


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 the untagged list representation, such as '(255 0 0).


rgb


Form
(rgb r g b)

Description
Return an 'Internet list' encoding the color (list r g b).


rgb-string


Form
(rgb-string r g b)

Description
Return an 'Internet' string encoding the color (list r g b).


rgb-color


Form
(rgb-color r g b)

Description
Returns the color encoding of (list r g b) given three numbers a parameters. The function rgb-color is an alias for rgb-string.

Parameters
rThe red color (a number between 0 and 255)
gThe green color (a number between 0 and 255)
bThe blue color (a number between 0 and 255)


rgb-string-list


Form
(rgb-string-list color-list)

Description
A variant of rgb-string, in which the colors are passed in one list.


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. The function rgb-color-list is an alias for rgb-string-list.

Parameters
color-triple-listA list of three numbers - red, green, and blue.


 

3.   COLOR CONSTRUCTOR, PREDICATE, AND SELECTORS.
The function make-color is an old version of the constructor, currently used by most of the LAML software. The function make-rgb-color is new version with a tagged representation. The predidate and the selectors only work with make-rgb-color.


make-color


Form
(make-color r g b)

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. Usue make-rgb-color with all new programs.


make-rgb-color


Form
(make-rgb-color r g b)

Description
Make and return a color represented by a red, green and blue constituent.


rgb-color?


Form
(rgb-color? x)

Description
Is x a color


red-of-rgb-color


Form
(red-of-rgb-color color)

Description
Return the red constituent of the color.


green-of-rgb-color


Form
(green-of-rgb-color color)

Description
Return the green constituent of the color.


blue-of-rgb-color


Form
(blue-of-rgb-color color)

Description
Return the blue constituent of the color.


 

4.   COLOR CONSTANTS.
All color constant return the old representation of the color.


red


Form
red

Description
A color constant. A color is represented as a list of integers of length three (rgb).


dark-red


Form
dark-red

Description
A color constant. A color is represented as a list of integers of length three (rgb).


green


Form
green

Description
A color constant. A color is represented as a list of integers of length three (rgb).


green1


Form
green1

Description
A color constant. A color is represented as a list of integers of length three (rgb).


green2


Form
green2

Description
A color constant. A color is represented as a list of integers of length three (rgb).


blue


Form
blue

Description
A color constant. A color is represented as a list of integers of length three (rgb).


white


Form
white

Description
A color constant. A color is represented as a list of integers of length three (rgb).


black


Form
black

Description
A color constant. A color is represented as a list of integers of length three (rgb).


yellow


Form
yellow

Description
A color constant. A color is represented as a list of integers of length three (rgb).


purple


Form
purple

Description
A color constant. A color is represented as a list of integers of length three (rgb).


light-blue


Form
light-blue

Description
A color constant. A color is represented as a list of integers of length three (rgb).


blue1


Form
blue1

Description
A color constant. A color is represented as a list of integers of length three (rgb).


blue2


Form
blue2

Description
A color constant. A color is represented as a list of integers of length three (rgb).


blue3


Form
blue3

Description
A color constant. A color is represented as a list of integers of length three (rgb).


orange


Form
orange

Description
A color constant. A color is represented as a list of integers of length three (rgb).


dark-yellow


Form
dark-yellow

Description
A color constant. A color is represented as a list of integers of length three (rgb).


grey1


Form
grey1

Description
A color constant. A color is represented as a list of integers of length three (rgb).


grey2


Form
grey2

Description
A color constant. A color is represented as a list of integers of length three (rgb).


brown


Form
brown

Description
A color constant. A color is represented as a list of integers of length three (rgb).


maroon


Form
maroon

Description
A color constant. A color is represented as a list of integers of length three (rgb).


grey


Form
grey

Description
A color constant. A color is represented as a list of integers of length three (rgb).


silver


Form
silver

Description
A color constant. A color is represented as a list of integers of length three (rgb).


tetal


Form
tetal

Description
A color constant. A color is represented as a list of integers of length three (rgb).


aqua


Form
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


Form
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


Form
olive

Description
A color constant. A color is represented as a list of integers of length three (rgb).


navy


Form
navy

Description
A color constant. A color is represented as a list of integers of length three (rgb).


fuchsia


Form
fuchsia

Description
A color constant. A color is represented as a list of integers of length three (rgb).


 

5.   NUMBER CONVERTING.


number-in-base


Form
(number-in-base n base)

Description
Return the decimal number n in base. n should be positive. Returns a string.


Generated: June 1, 2002, 16:56:02
This documentation has been extracted automatically from the Scheme source file by means of the Schemedoc tool