Your code is wrong.
The parameter of your TColorToHex is AColor , so you should use AColor in your GetRValue() etc... calls
Your wrong code:
function TForm3.TColorToHex(AColor: TColor): String;
begin
Result :=
{ red value }
IntToHex( GetRValue( Color ), 2 ) +
{ green value }
IntToHex( GetGValue( Color ), 2 ) +
{ blue value }
IntToHex( GetBValue( Color ), 2 );
end;
The correct code:
function TForm3.TColorToHex(AColor: TColor): String;
begin
Result :=
{ red value }
IntToHex( GetRValue( AColor ), 2 ) +
{ green value }
IntToHex( GetGValue( AColor ), 2 ) +
{ blue value }
IntToHex( GetBValue( AColor ), 2 );
end;