Skip to content

v3:Migration from v2

fujaru edited this page Feb 6, 2017 · 6 revisions

Obsolete Options

alpha

The alpha option was used to show/hide alpha slider which has been marked as deprecated since 2.0. In version 3.0, setting/getting alpha option will invoke setAlpha() or getAlpha() method which has different function, to adjust alpha value.

If you still use this option to show/hide alpha slider, please use sliders option instead. Below is a sample code to show/hide alpha slider on the left of preview column.

$('#toggle-btn').click(function() {
    var sliders = $('#color-input').wheelColorPicker('sliders');
    // To show alpha
    if(sliders.indexOf('a') < 0) {
        sliders.replace('p', 'ap');
    }
    // To hide alpha
    else {
        sliders.replace('a', '');
    }
    $('#color-input').wheelColorPicker('sliders', sliders);
}

autoConvert

The option has been renamed to autoFormat.

Obsolete Methods

color

Calling the color() method will now trigger setColor() or getColor(). Previously, this method used to accept color string (e.g. "#ff0000"). However, both setColor() and getColor() works with color object.

If you use color method to set value, e.g.

$(elm).wheelColorPicker('color', '#ff0000');

no changes are necessary since setColor() now also accepts color string to accomodate this transition.

If you use color method to get value, e.g.

var color = $(elm).wheelColorPicker('color'); // '#ff0000'

please use getValue() instead.

var color = $(elm).wheelColorPicker('getValue');