0

I am trying to display a spectrum color picker but somehow palettes are not displaying properly. Here Is the code

<input id="color">
<button ng-click="displayColorPicker()">Apply Spectrum </button>
 
// Angular js code
function displayColorPicker() {
  $('#color').spectrum({  // It successfully loaded but UI is broken
    showPalette: true,
    palette: [
      ['black', 'white', 'blanchedalmond'],
      ['rgb(255, 128, 0);', 'hsv 100 70 50', 'lightyellow']
    ]
  });

}

Following are the version details

  1. Jquery: 3.5.0

  2. Spectrum : 1.8.0

enter image description here

e kanojia
  • 67
  • 1
  • 2
  • 12

1 Answers1

0

I hit the same issue. Seems the repo isn't being maintainted to merge in pull requests.

A workaround is to have an array of arrays containing a single color. Essentially only one column of colors. Like this:

palette: [['white'],['black'],['blue']]

Martin Drapeau
  • 1,484
  • 15
  • 16