Reference createColorPicker()

createColorPicker()

Creates a color picker element.

The parameter, value, is optional. If a color string or p5.Color object is passed, it will set the default color.

Color pickers extend the p5.Element class with a couple of helpful methods for managing colors:

  • myPicker.value() returns the current color as a hex string in the format '#rrggbb'.
  • myPicker.color() returns the current color as a p5.Color object.

Examples

Syntax

createColorPicker([value])

Parameters

value
String|p5.Color:

default color as a CSS color string.

Returns

p5.Element: new p5.Element object.
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

Related References