Automattic / Iris

A(n awesome) Color Picker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wpColorPicker options and Iris options

afragen opened this issue · comments

I'm under the impression that all the options in Iris are not available to wpColorPicker.

In particular

var irisOnlyOptions = {
// the following option are available to iris not wpColorPicker
  color: false,
  mode: 'hsl',
  controls: {
    horiz: 's', // horizontal defaults to saturation
    vert: 'l', // vertical defaults to lightness
    strip: 'h' // right strip defaults to hue
    },
  border: true, // draw a border around the collection of UI elements
  target: false, // a DOM element / jQuery selector that the element will be appended within. Only used when called on an input.
  width: 150,
};

Is there some way to include these in wpColorPicker or am I out of luck?

Thanks.

You can set palettes at runtime width your wpColorPicker call. All of the other options can be changed by calling Iris directly on the input element like $(input).iris('option', 'width', newValue).

There's an issue with setting other options directly. I tried $(input).iris('option', 'width', 150); and get the error can't find variable input. I try the following $('input').iris('option', 'width', 150); and I get the following error [Error] Error: cannot call methods on iris prior to initialization; attempted to call method 'option'

If I add $('input').iris(); in front of the previous command I get no errors and the option takes but I get the problem described in #22. Other options, like $('input').iris('option', 'mode', 'hsl'); seem to work, just not the width

input was a placeholder for either the DOM Element itself or a selector that targets the text input that wpColorPicker is using.

Thanks Matt. I understand.