ColorPicker

The ColorPicker element extends the View interface and is designed to select a color in RGB format without an alpha channel.

To create a ColorPicker, the function is used:

func NewColorPicker(session Session, params Params) ColorPicker

You can set/get the current color value using the "color-picker-value" property (ColorPickerValue constant).The following can be passed as a value to the "color-picker-value" property:

  • Color
  • text representation of Color
  • constant

The value of the property "color-picker-value" can also be read using the function:

func GetColorPickerValue(view View, subviewID ...string) Color

The "color-changed" event (ColorChangedEvent constant) is used to track the change in the selected color.The main event listener has the following format:

func(picker ColorPicker, newColor, oldColor Color)

where the second argument is the new color value, the third argument is the previous color value.

Additional event listeners can have the following format

func(picker ColorPicker, newColor string)
func(newColor, oldColor string)
func(newColor string)
func(picker ColorPicker)
func()

You can get the current list of date change listeners using the function

func GetColorChangedListeners(view View, subviewID ...string) []func(ColorPicker, Color, Color)