Back

showColorPicker

JS Py
Hello World
Content:
- Properties
- Methods

Shows a color picker.

lrp = ui.showColorPicker( value, options ) → Object: ColorPicker Component

Customize a color or choose from the presets of color carefully selected from Material Design Color Pallette.

Properties

These are the setter and getter properties for the showColorPicker Component.

Example - Basic

class Main extends App
{
    onStart()
    {
        // Create a fullscreen layout with objects vertically centered
        this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")

        // Add a button to the main layout
        this.btn = ui.addButton(this.main, "Show Popup", "Primary")

        // Add callback handler for `onTouch` event
        this.btn.setOnTouch( this.showColorPicker )
    }

    showColorPicker()
    {
        // Show color picker dialog with `Alpha` option
        // to include alpha in the output format `#aarrggbb`
        ui.showColorPicker(null, "Alpha", this.onSelect)
    }

    onSelect( clr )
    {
        ui.showPopup( clr )
    }
}
from hybrid import ui

def OnStart():
    # Create a fullscreen layout with objects vertically centered
    main = ui.addLayout("main", "Linear", "VCenter,FillXY")

    # Add a button to the main layout
    btn = ui.addButton(main, "Show Popup", "Primary")

    # Add callback handler for `onTouch` event
    btn.setOnTouch(showColorPicker)

def showColorPicker(event):
    # Show color picker dialog with `Alpha` option
    # to include alpha in the output format `#aarrggbb`
    ui.showColorPicker(None, "Alpha", onSelect)

def onSelect(clr):
    ui.showPopup(clr)
Copy All       Run      

Methods

The following methods are available on the showColorPicker object:

getValue() → String
String: “A hexadecimal default value for the color picker.”
String: “A comma separated color picker options. Values can be
`Alpha` Includes an alpha”
String: Returns the value of the chosen color.
lrp.getValue
Returns the hexadecimal string color value of the color picker