THE META-HTML LANGUAGE REFERENCE MANUAL

Html Helpers [TOC] Using Gnuplot

Section Intro: Color Manipulation

Color Manipulation

Synopsis:

    Meta-HTML provides a few primitives for manipulating HTML color strings and names. You can convert from hexadecimal notation to decimal notation, from color names to hex strings and back, create SELECT widgets which allow the user to choose a color, and dynamically add new colors to the (rather extensive) list of colors that Meta-HTML knows about.

Commands:

<color::add-color COLOR NAME &optional [NICKNAME]Simple

    Associate COLOR with NAME and NICKNAME in the system color tables and arrays. COLOR is the hexadecimal representation of the color, in standard RRGGBB format. NAME is a pretty name of the color, as in "Antique White".

<color::color-name COLORSimple

    Given a string of hex digits (perhaps with a leading "#"), return the human readable name of that color as defined in our array of color names. The color names are definitely suitable for Netscape, since I got the names off of their pages.

     <color::color-name #F5FFFA>
     
    produces:
    Mint Cream
     

<color::decimal-to-hex BYTE-VALUESimple

    Return the two hex characters which represent BYTE-VALUE, a decimal number between 0 and 255 inclusive.

     <color::decimal-to-hex 132>
     
    produces:
    84
     

<color::hex-value COLORSimple

    Given the human readable name of a color in COLOR, return the color value as a string of 6 hex digits: RRGGBB.

     <color::hex-value "White Smoke">
     
    produces:
    F5F5F5
     

<color::opposite COLORSimple

    Return the "opposite" of COLOR in HTML format. COLOR is supplied in HTML format as well. For example: <color::opposite #000000> ==> #FFFFFF

<color::parse-hex-pair HEX-PAIRSimple

    Return the decimal value of HEX-PAIR.

     <color::parse-hex-pair 84>
     
    produces:
    132
     

<color::parse-rgb RGB-STRINGSimple

    Return an array of decimal values, one for each color in RGB-STRING.

     <color::parse-rgb #ff78e4>
     
    produces:
    255
    224
    228
     

<color::select-any-color VARNAME &key [JAVASCRIPT]Simple

    Create an HTML SELECTion pull-down menu containing the list of colors taken from the list of known colors in the system array COLOR::COLOR-NAMES. Assign the choice to VARNAME when the containing form is POSTed.

<color::select-color VARNAMESimple

    Create an HTML SELECTion pull-down menu containing a short list of colors including the primaries and hues. Assign the choice to VARNAME when the containing form is POSTed.

Edit Section
Function Index
Variable Index


The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox
Found a bug? Send mail to bug-manual@metahtml.org