tk\_chooseColor(n) Tk Built-In Commands tk\_chooseColor(n)

```

```

# [NAME](#NAME)

tk\_chooseColor - pops up a dialog box for the user to select a color.

# [SYNOPSIS](#SYNOPSIS)

**tk\_chooseColor** ?*option value ...*?

```

```

# [DESCRIPTION](#DESCRIPTION)

The procedure **tk\_chooseColor** pops up a dialog box for the user to select a color. The following *option-value* pairs are possible as command line arguments:

[**-initialcolor color**](#initialcolor)

Specifies the color to display in the color dialog when it pops up. *color* must be in a form acceptable to the **Tk\_GetColor** function.

[**-parent window**](#parent)

Makes *window* the logical parent of the color dialog. The color dialog is displayed on top of its parent window.

[**-title titleString**](#title)

Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed.

If the user selects a color, **tk\_chooseColor** will return the name of the color in a form acceptable to **Tk\_GetColor**. If the user cancels the operation, both commands will return the empty string.

# [EXAMPLE](#EXAMPLE)

```
button .b -bg [tk_chooseColor -initialcolor gray -title "Choose color"]
```

# [KEYWORDS](#KEYWORDS)

color, color selection, dialog

4.2 Tk

---

Document: tk_chooseColor(n) from tk 9.1.0-r0 (Chainguard OS)
Source: https://downloads.sourceforge.net/sourceforge/tcl/tk9.1.0-src.tar.gz
