13.3 Color

  • 13.3.1 Standard Color Names and Constants
  • 13.3.2 Contrasting Colors
  • color   [Protocol Class]
              

    A member of the class color is a completely opaque design 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 color class is the protocol class for a color, and is a subclass of design. If you want to create a new class that behaves like a color, it should be a subclass of color. All instantiable subclasses of color must obey the color protocol. [annotate]

    All of the standard instantiable color classes provided by CLIM are immutable. [annotate]

    A color can be specified by three real numbers between 0 and 1 (inclusive), giving the amounts of red, green, and blue. Three 0's 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. [annotate]

    [annotate]

    colorp  object [Protocol Predicate]
              

    Returns true if object is a color, otherwise returns false. [annotate]

    The following functions create colors. These functions produce objects that have equivalent effects; the only difference is in how the color components are specified. The resulting objects are indistinguishable when drawn. Whether these functions use the specified values exactly or approximate them because of limited color resolution is unspecified. Whether these functions create a new object or return an existing object with equivalent color component values is unspecified. [annotate]

    [annotate]

    make-rgb-color  red green blue [Function]
              

    Returns a member of class color. The red, green, and blue arguments are real numbers between 0 and 1 (inclusive) that specify the values of the corresponding color components. [annotate]

    [annotate]

    make-ihs-color  intensity hue saturation [Function]
              

    Returns a member of class color. The intensity argument is a real number between 0 and sqrt(3) (inclusive). The hue and saturation arguments are real numbers between 0 and 1 (inclusive). [annotate]

    [annotate]

    make-gray-color  luminance [Function]
              

    Returns a member of class color. luminance is a real number between 0 and 1 (inclusive). On a black-on-white display device, 0 means black, 1 means white, and the values in between are shades of gray. On a white-on-black display device, 0 means white, 1 means black, and the values in between are shades of gray. [annotate]

    The following two functions comprise the color protocol. Both of them return the components of a color. All subclasses of color must implement methods for these generic functions. [annotate]

    [annotate]

    color-rgb  color [Generic Function]
              

    Returns three values, the red, green, and blue components of the color color. The values are real numbers between 0 and 1 (inclusive). [annotate]

    [annotate]

    color-ihs  color [Generic Function]
              

    Returns three values, the intensity, hue, and saturation components of the color color. The first value is a real number between 0 andn sqrt(3) (inclusive). The second and third values are real numbers between 0 and 1 (inclusive). [annotate]

    [annotate]

    13.3.1 Standard Color Names and Constants

    Table 13.1 lists the commonly provided color names that can be looked up with find-named-color. Application programs can define other colors; these are provided because they are commonly used in the X Windows community, not because there is anything special about these particular colors. This table is a subset of the color listed in the file /X11/R4/mit/rgb/rgb.txt, from the X11 R4 distribution. [annotate]


    alice-blue antique-white aquamarine
    azure beige bisque
    black blanched-almond blue
    blue-violet brown burlywood
    cadet-blue chartreuse chocolate
    coral cornflower-blue cornsilk
    cyan dark-goldenrod dark-green
    dark-khaki dark-olive-green dark-orange
    dark-orchid dark-salmon dark-sea-green
    dark-slate-blue dark-slate-gray dark-turquoise
    dark-violet deep-pink deep-sky-blue
    dim-gray dodger-blue firebrick
    floral-white forest-green gainsboro
    ghost-white gold goldenrod
    gray green green-yellow
    honeydew hot-pink indian-red
    ivory khaki lavender
    lavender-blush lawn-green lemon-chiffon
    light-blue light-coral light-cyan
    light-goldenrod light-goldenrod-yellow light-gray
    light-pink light-salmon light-sea-green
    light-sky-blue light-slate-blue light-slate-gray
    light-steel-blue light-yellow lime-green
    linen magenta maroon
    medium-aquamarine medium-blue medium-orchid
    medium-purple medium-sea-green medium-slate-blue
    medium-spring-green medium-turquoise medium-violet-red
    midnight-blue mint-cream misty-rose
    moccasin navajo-white navy-blue
    old-lace olive-drab orange
    orange-red orchid pale-goldenrod
    pale-green pale-turquoise pale-violet-red
    papaya-whip peach-puff peru
    pink plum powder-blue
    purple red rosy-brown
    royal-blue saddle-brown salmon
    sandy-brown sea-green seashell
    sienna sky-blue slate-blue
    slate-gray snow spring-green
    steel-blue tan thistle
    tomato turquoise violet
    violet-red wheat white
    white-smoke yellow yellow-green
    [annotate]



    Table 13.1: Standard color names.

    In addition, the following color constants are provided. [annotate]

    +red+   [Constant]
    +green+   [Constant]
    +blue+   [Constant]
    +cyan+   [Constant]
    +magenta+   [Constant]
    +yellow+   [Constant]
    +black+   [Constant]
    +white+   [Constant]
              

    Constants corresponding to the usual definitions of red, green, blue, cyan, magenta, yellow, black, and white. [annotate]

    [annotate]

    13.3.2 Contrasting Colors

    make-contrasting-inks  n &optional k [Function]
              

    If k is not supplied, this returns a vector of n designs with recognizably different appearance. Elements of the vector are guaranteed to be acceptable values for the :ink argument to the drawing functions, and will not include +foreground-ink+, +background-ink+, or nil. Their class is otherwise unspecified. The vector is a fresh object that may be modified. [annotate]

    If k is supplied, it must be an integer between 0 and n - 1 (inclusive), in which case make-contrasting-inks returns the k'th design rather than returning a vector of designs. [annotate]

    If the implementation does not have n different contrasting inks, make-contrasting-inks signals an error. This will not happen unless n is greater than eight. [annotate]

    The rendering of the design may be a color or a stippled pattern, depending on whether the output medium supports color. [annotate]

    [annotate]

    contrasting-inks-limit  port [Generic Function]
              

    Returns the number of contrasting colors (or stipple patterns if port is monochrome or grayscale) that can be rendered on any medium on the port port. Implementations are encouraged to make this as large as possible, but it must be at least 8. All classes that obey the medium protocol must implement a method for this generic function. [annotate]

    [annotate]