Abstract instantiable class
The protocol class for colors.
red:<real>.
green:<real>.
blue:<real>.
intensity:limited(<real>, min: 0, max: sqrt(3().
hue:limited(<real>, min: 0, max: 1).
saturation:limited(<real>, min: 0, max: 1).
opacity:limited(<real>, min: 0, max: 1).
duim-dcsduim-dcs The <color> class is the protocol class for a color, and is a subclass of <ink>. A member of the class <color> is an ink that represents the intuitive definition of color: white, black, red, pale yellow, and so forth. The visual appearance of a single point is completely described by its color. Drawing a color sets the color of every point in the drawing plane to that color, and sets the opacity to 1.
The red:, green:, and blue: init-keywords represent the red, green, and blue components of the color. For an 8-bit color scheme, these can take any real number in the range 0 to 255.
The intensity describes the brightness of the color. An intensity of 0 is black.
The hue of a color is the characteristic that is represented by a name such as red, green, blue and so forth. This is the main attribute of a color that distinguishes it from other colors.
The saturation describes the amount of white in the color. This is what distinguishes pink from red.
Opacity controls how new color output covers previous color output (that is, the final appearance when one color is painted on top of another). Opacity can vary from totally opaque (a new color completely obliterates the old color) to totally transparent (a new color has no effect whatsoever; the old color remains unchanged). Intermediate opacity values result in color blending so that the earlier color shows through what is drawn on top of it.
All of the standard instantiable color classes provided by DUIM are immutable.
A color can be specified by four real numbers between 0 and 1 (inclusive), giving the amounts of red, green, blue, and opacity (alpha). Three 0's for the RGB components mean black; three 1's mean white. The intensity-hue-saturation color model is also supported, but the red-green-blue color model is the primary model we will use in the specification.
An opacity may be specified by a real number between 0 and 1 (inclusive). 0 is completely transparent, 1 is completely opaque, fractions are translucent. The opacity of a color is the degree to which it hides the previous contents of the drawing plane when it is drawn.
The following operations are exported from the DUIM-DCs module.
= color? color-rgb color-ihs color-luminosity