How to detect dark mode in Delphi FireMonkey macOS (e.g. Big Sur) apps?
How to detect dark mode in Delphi FireMonkey macOS (e.g. Big Sur) apps?
You can use FireMonkey platform services to get that information:
uses
FMX.Platform;
function GetSystemTheme: TSystemThemeKind;
var
LService: IFMXSystemAppearanceService;
begin
Result := TSystemThemeKind.Unspecified;
if TPlatformServices.Current.SupportsPlatformService(IFMXSystemAppearanceService, LService) then
Result := LService.GetSystemThemeKind;
end;
Where TSystemThemeKind is declared as
TSystemThemeKind = (Unspecified, Light, Dark);
IFMXSystemAppearanceService is currently supported on Android, iOS and macOS.