Name
ColorRequest -- prompt the user to select a color (V5.0)
Synopsis
ret = ColorRequest(title$[, t])
Deprecated syntax
ret = ColorRequest(title$[, color])
Function
This command opens a color requester prompting the user to select a color from a palette of predefined colors. Additionally, the user can also mix a custom color. The title$ argument can be used to set the title for the color requester's dialog window. If an empty string ("") is passed as title$, the requester will use the title specified in the @APPTITLE preprocessor command.

ColorRequest() supports several optional arguments. Before Hollywood 9.0, those had to be passed as optional parameters (see above). Since Hollywood 9.0, however, it is recommended to use the new syntax, which has a single optional table argument that can be used to pass one or more optional arguments to ColorRequest().

The following table fields are recognized by this function:

Color:
This table tag can be used to specify a color that is initially selected. If you do not set this table tag, a random color will be preselected.

X:
Initial x-position for the color requester on the screen. Not all platforms support this. (V9.0)

Y:
Initial y-position for the color requester on the screen. Not all platforms support this. (V9.0)

Width:
Initial width for the color requester dialog. Not all platforms support this. (V9.0)

Height:
Initial height for the color requester dialog. Not all platforms support this. (V9.0)

Please note that this command requires reqtools.library to be installed on AmigaOS and compatibles.

Inputs
title$
title for the requester
t
optional: table containing further arguments (see above) (V9.0)
Results
ret
the user's selection or -1 if the user cancelled the requester
Example
r = ColorRequest("Select a color")
If r = -1
  Print("Requester cancelled!")
Else
  SetFillStyle(#FILLCOLOR)
  Box(0, 0, 640, 480, r)
EndIf
Ask the user for a color and then draws a filled rectangle using the selected color.

Show TOC