<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
+ else if (pos('#', AText) = 1) and (Length(AText) = 7) then begin<br>
+ Delete(AText, 1, 1);<br>
+ Result.Red := StrToInt('$' + copy(AText, 1, 2)) shl 8;<br>
+ Result.Green := StrToInt('$' + copy(AText, 3, 2)) shl 8;<br>
+ Result.Blue := StrToInt('$' + copy(AText, 5, 2)) shl 8;<br>
+ end else<br>
+<br>
<br>
<table class="diff-table tab-size " data-tab-size="8">
<tbody>
<tr>
</tr>
</tbody>
</table>
<span class="blob-code-inner"><br>
you convert #rrggbb, but don't convert #rgb (eg #123 means
#112233). <br>
example from ATSynEdit -</span>
<p> //allow only #rgb, #rrggbb<br>
Len:= Length(s);<br>
if (Len<>3) and (Len<>6) then exit;<br>
<br>
for i:= 1 to Len do<br>
if not IsCharHex(s[i]) then exit;<br>
<br>
if Len=6 then<br>
begin<br>
N1:= StrToInt('$'+Copy(s, 1, 2));<br>
N2:= StrToInt('$'+Copy(s, 3, 2));<br>
N3:= StrToInt('$'+Copy(s, 5, 2));<br>
end<br>
else<br>
begin<br>
N1:= StrToInt('$'+s[1]+s[1]);<br>
N2:= StrToInt('$'+s[2]+s[2]);<br>
N3:= StrToInt('$'+s[3]+s[3]);<br>
end;<br>
<br>
Result:= RGBToColor(N1, N2, N3);<br>
end;<br>
<br>
</p>
<pre class="moz-signature" cols="72">my code also has checking for Hex, and yours dont have check for hex. so '#aazz33' will crash.
--
Regards,
Alexey</pre>
</body>
</html>