diff --git a/spectrum.js b/spectrum.js index 17078542..b096a6b6 100644 --- a/spectrum.js +++ b/spectrum.js @@ -32,6 +32,7 @@ cancelText: "cancel", chooseText: "choose", clearText: "Clear Color Selection", + noColorSelectedText: "No Color Selected", preferredFormat: false, className: "", // Deprecated - use containerClassName and replacerClassName instead. containerClassName: "", @@ -113,7 +114,7 @@ ].join(""); })(); - function paletteTemplate (p, color, className, tooltipFormat) { + function paletteTemplate (p, color, className, opts) { var html = []; for (var i = 0; i < p.length; i++) { var current = p[i]; @@ -121,12 +122,17 @@ var tiny = tinycolor(current); var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light"; c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : ""; - var formattedString = tiny.toString(tooltipFormat || "rgb"); + var formattedString = tiny.toString(opts.preferredFormat || "rgb"); var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter(); html.push(''); } else { var cls = 'sp-clear-display'; - html.push(''); + html.push($('
') + .append($('') + .attr('title', opts.noColorSelectedText) + ) + .html() + ); } } return "