Works even in IE6
Love that quote from the color picker over at RaphaelJS land. This plugin by Dmitry Baranovskiy gives you an easy color picker in short order:
JAVASCRIPT:
-
-
var icon = Raphael(“picker”, 23, 23).colorPickerIcon(11, 11, 10);
-
-
icon.attr({cursor: ”pointer”}).node.onclick = function () {
-
document.getElementById(“benefits”).style.visibility = ”visible”;
-
var out = document.getElementById(“output”);
-
out.style.visibility = ”visible”;
-
-
// this is where colorpicker created
-
var cp = Raphael.colorpicker(document.body.offsetWidth / 2 - 150, 250, 300, ”#eee”, document.getElementById(“picker2″));
-
-
out.onkeyup = function () {
-
cp.color(this.value);
-
};
-
// assigning onchange event handler
-
cp.onchange = function (clr) {
-
out.value = clr;
-
document.body.style.background = clr;
-
document.body.style.color = Raphael.rgb2hsb(clr).b <.5 ? ”#fff” : ”#666″;
-
};
-
// that’s it. Too easy
-
-
icon.node.onclick = null;
-
};
-
