2

I am using Spectrum color picker plugin.

I am trying to change the position of the custom added colors (sp-palette-row-selection) over to another place? How can I edit the JavaScript to allow me to do so?

Here's a link to the full JavaScript code: spectrum.js.

I think the important function were looking for (of the JavaScript file) is this:

function drawPalette() {

    var currentColor = get();

    var html = $.map(paletteArray, function (palette, i) {
        return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
    });

    updateSelectionPaletteFromStorage();

    if (selectionPalette) {
        html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
    }

    paletteContainer.html(html.join(""));
}

I removed the inside of the if-statement, and added the following:

$('.sp-input-container').after($('.sp-palette-row-selection'));

But when I did that, I didn't see the "custom added colors" at all.

Horay
  • 1,388
  • 2
  • 19
  • 36

0 Answers0