Sign in Join
FPDoc Onlineexperiment

ColorToRGB function

In unit Graphics

Converts a TColor value to an RGB color constant.

Declaration

pascal
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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.