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

StringToColor

Converts the specified string representation for a color to a TColor value.

Declaration

Source position: graphics.pp line 1923

function StringToColor(

  const S: shortstring

):TColor;

Arguments

S

  

String with the color identifier or hexadecimal byte values converted in the routine.

Function result

Returns the TColor value corresponding to the value in S.

Description

StringToColor is used to convert the string in S to its value as a TColor type. The S argument can contain a color identifier like 'clRed' or 'clForm', or a hexadecimal string with the bytes for the color in GBR byte order like '$00D7FF'.

The return value contains the LongInt value for the color. When S is a valid color identifier, the corresponding color constant is returned; e.g. clRed or clForm. If S is not a color identifier, it is converted to an Integer value and cast to the TColor type for use as the return value. The default return value is clNone.

Use StringToColorDef to convert a color string to its TColor value using a specified default TColor value.

See also

StringToColorDef

  

Converts the specified string representation for a color to a TColor value using a specified default value.

IdentToColor

  

IdentToColor - given a color identifier (name) returns the color value.


Version 4.0 Generated 2025-05-03 Home