ui/eg/colorpicker
Noah Petherbridge fee6e1e105 New widget: ColorPicker, plus other changes
New properties are added to EventData for Supervisor events:

* Widget: a reference to the widget which is receiving the event.
* Clicked (bool): for MouseMove events records if the primary button is pressed.
* func RelativePoint(): returns a version of EventData.Point adjusted to be
  relative to the Widget (0,0 at the Widget's absolute position on screen).

Other changes:

* Destroy() method for the Widget interface: widgets that need to free up resources
  on teardown should define this, the BaseWidget provides a no-op implementation.
* Window.Resize() will properly resize a Window.
* Window.Center(w, h int) to easily center a window on screen.
2022-01-01 18:43:36 -08:00
..
main.go New widget: ColorPicker, plus other changes 2022-01-01 18:43:36 -08:00
README.md New widget: ColorPicker, plus other changes 2022-01-01 18:43:36 -08:00
screenshot.png New widget: ColorPicker, plus other changes 2022-01-01 18:43:36 -08:00

ColorPicker Demo

Screenshot

This demo shows off the ColorPicker window.

The ColorPicker lets you ask the user to select a color, visually, using a callback interface. While the UI toolkit doesn't support text input entry, there is a work-around to prompt the user to enter a color by hex code with assistance of your program.

In this example program, clicking on the Hex color button will prompt you via STDIN (check the terminal window!) to enter a color value. The UI will be frozen until your answer is given. For programs that don't need this, the Hex color button does nothing when clicked.

Running It

From your terminal, just type go run main.go from this example's directory.