参考 createColorPicker()

createColorPicker()

创建一个颜色选择器元素。

参数value是可选的。如果传递了颜色字符串或p5.Color对象,则会设置默认颜色。

颜色选择器扩展了p5.Element类,增加了一些管理颜色的有用方法:

  • myPicker.value()以十六进制字符串格式'#rrggbb'返回当前颜色。
  • myPicker.color()p5.Color对象形式返回当前颜色。

示例

语法

createColorPicker([value])

参数

value
字符串|p5.Color:

默认颜色,为CSS颜色字符串

返回值

p5.Element: 新的p5.Element对象。
This page is generated from the comments in src/dom/dom.js . Please feel free to edit it and submit a pull request!

相关参考