Let me be the first to admit that this isn't my own code.
I found it on the web somewhere, all I did was turn it
into a function (and add the # sign) instead of a
procedure. But my guess is that I am not the only one
looking for ways to do this hence I am posting it.
Helpful people who are making webpage software.
I suggest you use a ColorDialog in conjunction with
this function for maximum effect.
Code:
function ColorToHexColor(thisColor: TColor): string;
var RGBValue: TColorRef;
begin
RGBValue := ColorToRGB(thisColor);
Result := '#' + Format('%.2x%.2x%.2x',
[GetRValue(RGBValue),
GetGValue(RGBValue),
GetBValue(RGBValue)]);
end;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.