I used TStyleManager for style control and added the .styles files to the resource. However, this increased the size too much and I want to include multiple styles. So I embedded compressed zip files instead. Each style became ~15% of its original size. It is also not difficult to handle:
// modified from my code, not tested but should work
function LoadZippedStyleFromResource(const ResName, Filename: string): TFmxObject;
var
rs, ms: TStream;
ZipFile: TZipFile;
ZipHeader: TZipHeader;
begin
try
rs := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
ZipFile := TZipFile.Create;
try
ZipFile.Open(rs, zmRead);
ZipFile.Read(Filename, ms, ZipHeader);
try
ms.Position := 0;
Result := TStyleStreaming.LoadFromStream(ms);
finally
ms.Free;
end;
finally
ZipFile.Free;
FreeAndNil(rs);
end
except
FreeAndNil(rs);
Exit(nil);
end;
end;
// used like this
Style := LoadZippedStyleFromResource('Polar', 'PolarDark.style');
if Assigned(Style) then TStyleManager.SetStyle(Style);