I've always used GetRValue, GetGValue and GetBValue functions (From Winapi.Windows unit) for extracting the RGB values for a TColor.
Unfortunately, the same approach does not seem to be good for system colors like clWindow, clBtnFace and so on.
For example:
var
MyColor : TColor;
begin
MyColor := clBtnFace;
ShowMessage(
'R = ' + IntToStr(GetRValue(MyColor)) + sLineBreak +
'G = ' + IntToStr(GetGValue(MyColor)) + sLineBreak +
'B = ' + IntToStr(GetBValue(MyColor))
);
end;
It produces the following output:
R = 15
G = 0
B = 0
Which should looks like this:
On my system, I see the following color instead:


Using
Get(R|G|B)Value()will work just fine with system colors, you just need to convert them to RGB first. Use theColorToRGB()function for that:For example: