Skip to content
fujaru edited this page Feb 6, 2017 · 14 revisions

Methods

Methods can be called by first selecting jQuery objects. The syntax is:

$(elm).wheelColorPicker('methodName', arg1, arg2, ...)

Setters/getters since 3.0
Since version 3.0, setter and getters (methods prefixed with "set" or "get") can be treated as options.

// Two ways to call setValue
$(elm).wheelColorPicker('setValue', '#ff0088');
$(elm).wheelColorPicker('value', '#ff0088');

// Two ways to call getValue
$(elm).wheelColorPicker('getValue');
$(elm).wheelColorPicker('value');

alpha

since 2.0 deprecated by 2.0 obsolete by 3.0

$(elm).wheelColorPicker('alpha' [, number value])

This function is made to maintain compatibility with deprecated alpha option.

color

since 1.x deprecated by 2.0 obsolete by 3.0

$(elm).wheelColorPicker('color' [, string value])

Get/set color. This function is deprecated. To get color, use getValue() and to set color, use setValue() instead of this function.

Note: Since version 3.0, invoking the above code as getter will return color object instead of string.

destroy

since 1.x

$(elm).wheelColorPicker('destroy')

Destroy the color picker and return an element to its normal state.

getColor

since 2.0

object $(elm).wheelColorPicker('getColor')

Return color components as an object. The object consists of:

{
  r: red,
  g: green,
  b: blue,
  h: hue,
  s: saturation,
  v: value,
  a: alpha
}

getValue

since 1.x

string $(elm).wheelColorPicker('getValue' [, string format])

Return the color value as string in specified format. If format is not provided, it will use the format specified in format option. See colorToStr() for more information regarding available formats.

hide

since 1.x

$(elm).wheelColorPicker('hide', event e)

Hide the color picker dialog. This function is only applicable to popup mode color picker layout.

init

since 1.x

$(elm).wheelColorPicker('init')

Initialize wheel color picker. There's no need to explicitly call init function as this function is automatically called during first time $(elm).wheelColorPicker([options]) is executed.

redrawSliders

since 3.0

$(elm).wheelColorPicker( 'redrawSliders' [, boolean force] )

redrawSliders

since 2.0 deprecated by 3.0

$(elm).wheelColorPicker( 'redrawSliders' [, string sliders [, boolean force]] )

refreshWidget

since 3.0

$(elm).wheelColorPicker( 'refreshWidget' )

setAlpha

since 2.0

$(elm).wheelColorPicker( 'setAlpha', number value, boolean updateInput = true )

Set alpha value.

setColor

since 2.0

$(elm).wheelColorPicker( 'setColor', object color )

Set color by specifying component values. Supported color object values are set of RGB(A), HSV(A), or A only.

// Sets RGB(A)
{ r: 1, g: 0.5, b: 0.5 }
// Sets HSV(A)
{ h: 0.25, s: 1, v: 0.5 }
// Change alpha only to existing color
{ a: 0.8 }

setHsv

since 2.0

$(elm).wheelColorPicker( 'setHsv', number h, number s, number v, boolean updateInput = true )

Set color using HSV combination. Each HSV component is a number between 0 to 1.

setHsva

since 2.0

$(elm).wheelColorPicker( 'setHsva', number h, number s, number v, number a, boolean updateInput = true )

Set color using HSVA combination. Each HSVA component is a number between 0 to 1.

setOptions

since 3.0

$(elm).wheelColorPicker( 'setOptions', object options )

Set multiple options to the color picker. if htmlOptions is set to true, options set via HTML attributes are also reloaded. If both HTML attributes and arguments exist, options set via options argument gets priority.

setRgb

since 2.0

$(elm).wheelColorPicker( 'setRgb', number r, number g, number b, boolean updateInput = true] )

Set color using RGB combination. Each RGB component is a number between 0 to 1.

setRgba

since 2.0

$(elm).wheelColorPicker( 'setRgba', number r, number g, number b, number a, boolean updateInput = true] )

Set color using RGBA combination. Each RGBA component is a number between 0 to 1.

setValue

since 1.x

$(elm).wheelColorPicker('setValue', string value, boolean updateInput = true] )

Set color value by providing string. Various formats are accepted. See strToColor() for available formats.

show

since 1.x

$(elm).wheelColorPicker('show')

Show the color picker dialog. This function is only applicable to popup mode color picker layout.

staticInit

since 2.0 obsolete by 3.0

void $(elm).wheelColorPicker('staticInit')

Initialization for all color pickers. This function is called automatically during initialization of any first color picker. No need to call this function explicitly. On version 3.0, this function is moved to $.fn.wheelColorPicker.ColorPicker.init()

updateInput

since 3.0

$(elm).wheelColorPicker( 'updateInput' )

Update input value and background color (if preview is on).

updateSelection

since 1.x deprecated by 2.0

$(elm).wheelColorPicker('updateSelection')

Update color dialog selection to match current selectedColor value. This function is deprecated since it can be replaced by executing the following lines:

$(elm).wheelColorPicker('redrawSliders');
$(elm).wheelColorPicker('updateSliders');

updateSliders

since 2.0

$(elm).wheelColorPicker('updateSliders')

Update sliders cursor to match selected color.