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

# ColorToString

Gets a string representation for the specified TColor value.

## Declaration

Source position: graphics.pp line 1933

`function ColorToString(`
`Color: TColor`
`):AnsiString;`

## Arguments

`Color` |  | The TColor value examined in the routine.

## Function result

AnsiString with the hexadecimal byte values or the color identifier name for the specified color value.

## Description

ColorToString converts the TColor value in the Color argument to a string representation for the color. Color may contain either a named color identifier, like clRed or clForm, or a custom color value not represented by a color identifier like TColor($00D7FF).

For named color identifiers, the return value contains the string representation for the identifier; e.g. 'clRed' or 'clForm'. For colors which are not recognized in the standard Colors map, the return value contains the hexadecimal representation for the color in ABGR (Alpha Blue Green Red) byte order; e.g. '$0000D7FF'.

Use StringToColor or StringToColorDef to convert the string representation for a color to its TColor equivalent.

## See also

ColorToIdent |  | ColorToIdent - given a Color value, find its name (Ident) in the look-up table of Colors.
ColorToRGB |  | Converts a TColor value to an RGB color constant.
ColorIndex |  | Finds the position in the color identifier map for the specified value.
StringToColor |  | Converts the specified string representation for a color to a TColor value.
StringToColorDef |  | Converts the specified string representation for a color to a TColor value using a specified default value.