/ Published in: Delphi
Expand |
Embed | Plain Text
function HtmlToColor(s:string;aDefault:Tcolor):TColor; begin if copy(s,1,1)='#' then begin s:='$'+copy(s,6,2)+copy(s,4,2)+copy(s,2,2); end else s:='clNone'; try result:=StringToColor(s); except result:=aDefault; end; end; function ColorToHtml(DColor:TColor):string; var tmpRGB : TColorRef; begin tmpRGB := ColorToRGB(DColor) ; Result:=Format('#%.2x%.2x%.2x', [GetRValue(tmpRGB), GetGValue(tmpRGB), GetBValue(tmpRGB)]) ; end; {function ColorToHtml}
You need to login to post a comment.
