Getting the HTML color string when given a TColor
   


If you work with HTML, you know that sometimes you need the HTML equivalent of a color (the hex value). GetHTMLColor2() will convert any TColor to it's HTML value. For example, GetHTMLColor2(clBlue) will return #0000FF.

function GetHTMLColor2(Value: TColor): string;
begin
  with TRGBQuad(ColorToRGB(Value)) do
    Result := '#' + IntToHex(RGB(rgbRed, rgbGreen, rgbBlue), 6);
end;


Blue Orb Software

[email protected]