The Mozilla
Organization
At A Glance
Feedback
Get Involved
Newsgroups
License Terms
Newsbot
Developer Docs
Roadmap
Projects
Ports
Module Owners
Hacking
Get the Source
Build It
Testing
Download
Bugzilla
Bug Writing
Tools
View Source
Tree Status
New Checkins
Submit A Bug
FAQ
Search
Color Picker

[Table of Contents] [Previous: Windows and Dialogs]

Feature Owner: Stuart Parmenter

A color picker is a frame that contains a graphical representation of multiple colors.

The color picker is specified using the colorpicker tag. The attribute type is used to specify the type of color picker such as swatch. If this attribute is omitted, the color picker will be a swatch. [Note: The only color picker currently implemented is a swatch.]

<colorpicker type="swatch"/>

Palettes can be chosen using the palettename attribute. Currently supported are standard which is a 70 color palette, web which is the 216 "web safe" palette, and grey which is a grey scale palette. If this attribute is omitted, you will get the standard palette. [Note: It is currently not possible to change colors or add custom colors.]

<colorpicker type="swatch" palettename="web"/>

When a color is selected, the color attribute is set containing the color that was selected. An example of this is below:

<html:script>
  function doSomethingUseful(cp)
  {
    var color = cp.getAttribute('color');
    document.getElementById("input").value = color;
  }
</html:script>
 
<colorpicker id="cp" onclick="doSomethingUseful(this);"/>
<html:input id="input"/>


[Table of Contents] [Previous: Windows and Dialogs]
Contact us at xptoolkitstaff@netscape.com. Want to complain about the new documentation? Email Dave Hyatt.

Copyright © 1998-2000 The Mozilla Organization.
Last modified September 4, 1999.