ad_color_widget

one of the documented procedures in this installation of the ACS
Usage:
ad_color_widget   name   default   { use_js "0" }
What it does:
Returns a color selection widget, optionally using JavaScript. Default is a string of the form '0,192,255'.
Defined in: /web/philip/packages/acs-core/widgets-procs.tcl

Source code:


    set out "<table cellspacing=0 cellpadding=0><tr><td><select name=$name.list"
    if { $use_js != 0 } {
	append out " onChange=\"adUpdateColorText('$name')\""
    }
    append out ">\n"

    set items [list "custom:" "none"]
    set values [list "custom" ""]

    foreach color [ad_html_colors] {
	lappend items [lindex $color 0]
	lappend values "[lindex $color 1],[lindex $color 2],[lindex $color 3]"
    }

    append out "[ad_generic_optionlist $items $values $default]</select>\n"

    if { ![regexp {^([0-9]+),([0-9]+),([0-9]+)$} $default all c1 c2 c3] } {
	set c1 ""
	set c2 ""
	set c3 ""
    }

    foreach component { c1 c2 c3 } {
	append out " <input name=$name.$component size=3 value=\"[set $component]\""
	if { $use_js } {
	    append out " onChange=\"adUpdateColorList('$name')\""
	}
	append out ">"
    }

    if { $use_js == 1 } {
	if { $c1 == "" } {
	    set c1 255
	    set c2 255
	    set c3 255
	}
	append out "</td><td>&nbsp; <img name=color_$name src=\"/shared/1pixel.tcl?r=$c1&g=$c2&b=$c3\" width=26 height=26 border=1>"
    }
    append out "</td></tr></table>\n"
    return $out


philg@mit.edu