In VCL, I could simply call the ColorToString
function from System.UIConsts
, but this function is VCL only because it uses TColor
:
function ColorToString(Color: TColor): string;
begin
Result := ColorToStringExt(Color, csfIdent);
end;
I would have expected there to be an overloaded version of ColorToString
that makes it work for FMX also, but no.
Ah. After searching for a little bit more, I found that there's the AlphaColorToString
function within System.UIConsts
:
function AlphaColorToString(Value: TAlphaColor): string;
begin
AlphaColorToIdent(Integer(Value), Result);
if Result.Chars[0] = 'x' then
Result := '#' + Result.SubString(1)
else
Result := Result.Remove(0, 3);
end;
So that's what needs to be used in FMX.