|
NEW: colorpicker.js moved to Google Code. This script provides an easy to use and integrate HSV color picker. see the DEMO or just download (VERSION 0.9) it (includes prototype and script.aculo.us) How to implement it
Optionsswatch ... specify and ID of an element that will be used as a button to open the colorPicker popUp, and will also display the selected color as it's background. IMAGE_BASE ... base URL where the images used for the ColorPicker are located (including the trailling slash)
Full Example<form><p>color 1 #<input type="text" id="colorfield1" value="FF33FF"></p><p>color 2 #<input type="text" id="colorfield2" value="CC3366"></p><p>color 3 #<input type="text" id="colorfield3" value="66FF66"></p><p>color 4 #<input type="text" id="colorfield4" value="339900"> <button style="width: 1.5em; height: 1.5em; border: 1px outset #666;" id="colorbox4" class="colorbox"></button></p></form> <script type="text/javascript">["1", "2", "3"].each(function(idx) { new Control.ColorPicker("colorfield" + idx, { IMAGE_BASE : "img/" });});new Control.ColorPicker("colorfield4", { "swatch" : "colorbox4" });</script>
STYLESHEETTo make the ColorPicker work like it should, you also need to include the colorpicker.css file to your page. This file defines the appearance of the ColorPicker PopUp and is using the following keys:
LicenseThis script is published under an MIT-License (just as script.aculo.us) Creditswritten by Matthias Platzer AT knallgrau.atinspired by YUI Color Picker script.implemented using script.aculo.us, YUI Util color.js and some more EasyRGB math |
|
||||||||||
| Lösungen | Projekte | Unternehmen | Presse | Deutsch English |

