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

default color as a CSS color string.

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