---
title: "createColorPicker"
canonical: "https://help.vicon.com/space/Shogun16/13340062/createColorPicker"
format: markdown
---
# Description

Creates a color picker user control on the user window thats is specified by `windowID`.

A color picker allows the user to specify a color, using either the predefined colors, or by bringing up the custom color map.

The control is initially placed in the top-left corner of the user window, and must be placed by using the `-pos` option, or by using the [setControlPos](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340122) command.

The command returns the Control ID of the user control, which should be saved for later operations on the control.

## Functional area

User Window

# Command syntax

## Syntax

|  |
| --- |
| `createColorPicker parentWindowID[-hidden] [-pos integer array] [-form integer] [-color integer array]` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `windowId` | int | yes | ID of User Window to place the control on. |

### Flags

> Macro (scroll-tablelayout)

| **Name** | **Flag arguments** | **Argument type** | **Exclusive to** | **Comments** |
| --- | --- | --- | --- | --- |
| `hidden` | 0 | — | — | Specifies that the control should be hidden initially. Call [showControl](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13341839) to subsequently make it visible. The default is for it to be visible. |
| `color` | 1 | integer array | — | A 3-element int array representing RGB values from 0255, specifying the initial color of the control. The default is blue. |
| `pos` | 1 | integer array | — | A 4-element int array representing a rectangle, which specifies the initial size/position of the control relative to the top left corner of the user window. The element order is Left, Top, Right, and Bottom. The default is a color picker 20 units high by 50 units wide. |
| `form` | 1 | integer | — | Control ID of the form user control which will dynamically position this control. |

## Return value

integer

## Examples

```plaintext
// Create a Color Picker User Control.
int $windowId;
int $controlId;
int $color[3];
 
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
// Specify the initial color of the control, Red
$color [0] = 255; // Red
$color [1] = 0;   // Green
$color [2] = 0;   // Blue
  
// Create the Control on the Window, passing
// in the Window Id of the User Window we 
// just created. Make the Control tri-state and set
// its text
$controlId = `createColorPicker $windowId -color $color`;
```

# Additional information

## Related commands

- [getColorPickerColor](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340982)
- [setColorPickerColor](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13340134)