StringToColorDef function
Converts the specified string representation for a color to a TColor value using a specified default value.
Declaration
function StringToColorDef(const S: shortstring;
const DefaultValue: TColor): TColorArguments
S | String with the color identifier or hexadecimal byte values converted in the routine. |
DefaultValue | Default TColor value used when S is not a valid representation for a color. |
Function result
TColor value for the specified string, or the default value when S does not contain a valid representation for a color.
Description
StringToColorDef 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 DefaultValue argument contains
the default value used when S is not a valid color string.
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 specified in the DefaultValue argument.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
