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

ColorToRGB

Converts a TColor value to an RGB color constant.

Declaration

Source position: graphics.pp line 1921

function ColorToRGB(

  Color: TColor

):LongInt;

Arguments

Color

  

TColor value converted in the method.

Function result

TColor value after the Alpha channel is removed from the input value.

Description

ColorToRGB ensures that TColor values for special and system colors remove the non-RGB values in the constant (Alpha channel).

To get a hexadecimal string for a color value with the bytes in RGB order use:

// var ColorStr: String;
ColorStr := '$'+ Red(clMoneyGreen).ToHexString(2) + 
  Green(clMoneyGreen).ToHexString(2) + 
  Blue(clMoneyGreen).ToHexString(2);

Use RGBToColor to convert individual RGB byte values to a TColor value.

See also

SysColorToSysColorIndex

  

SysColorToSysColorIndex - if Color is one of the system colors, returns the Index of the system color.

Red

  

Finds the Red component of the supplied color.

Green

  

Finds the Green component of the supplied color.

Blue

  

Finds the Blue component of the supplied color.

RGBToColor

  

Combines the values for Red, Green and Blue into a TColor value.

GetSysColor

  

Retrieves the system color for standard display elements.


Version 4.0 Generated 2025-05-03 Home