e kanojia
e kanojia

Reputation: 87

spectrum.js palette not display properly in UI

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

Upvotes: 0

Views: 270

Answers (1)

Martin Drapeau
Martin Drapeau

Reputation: 1534

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']]

Upvotes: 0

Related Questions