[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Dialogs' (#lcl)

# TColorDialog

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a dialog used to select a TColor value.

## Declaration

Source position: dialogs.pp line 320

`type TColorDialog = class(TCommonDialog)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`function DefaultTitle; override;` |  | Gets the default title used in the caption for the color selection dialog.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`published`
`property Title: TTranslateString;` |  | The Title or Caption displayed in the title bar for the dialog.
`property Color: TColor; [rw]` |  | Color selected by the user in the color dialog.
`property CustomColors: TStrings; [rw]` |  | Defines the color names and values available in the color dialog.
`property Options: TColorDialogOptions; [rw]` |  | Indicates the optional features enabled (or disabled) for the color dialog.
`end;`

## Inheritance

`TColorDialog` |  | Implements a dialog used to select a TColor value.
`TCommonDialog` |  | The base type from which other dialogs are derived.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TColorDialog is a TCommonDialog descendant which implements a dialog used to select a color value from a palette of colors. It is a wrapper for the native color selection dialog on platforms supported by the LCL (when available).

The dialog allows a TColor value to be selected from a group of predefined basic colors, custom colors, or using a color wheel or pad. On some platforms, the color can be specified using RGB or HSL (Hue, Saturation, Luminosity) values.

Use the CustomColors property to define color values using identifiers and hexadecimal RGB values for the custom colors.

Set the value for the Title property (when needed) prior to displaying the color selection dialog.

Call the Execute method to display the color dialog and capture the color value. If the user clicks on the OK button in the dialog, the selected color value is returned in the Color property and the UserChoice property is set to mrOK. A value other than mrOK indicates that the color selection dialog was cancelled or closed without selecting a color value.

## See also

TColorDialog.Color |  | Color selected by the user in the color dialog.
TColorDialog.CustomColors |  | Defines the color names and values available in the color dialog.
TCommonDialog.Title |  | The Title or Caption displayed for the dialog.
TCommonDialog.Execute |  | Displays the dialog and captures the result.
TCommonDialog.UserChoice |  | Contains the modal result value selected by the user.