如何在 Delphi FireMonkey macOS 应用程序中检测暗黑模式(例如 Big Sur)?
如何在 Delphi FireMonkey macOS 应用程序中检测暗黑模式(例如 Big Sur)?
您可以使用FireMonkey平台服务获取该信息:
uses
FMX.Platform;
function GetSystemTheme: TSystemThemeKind;
var
LService: IFMXSystemAppearanceService;
begin
Result := TSystemThemeKind.Unspecified;
if TPlatformServices.Current.SupportsPlatformService(IFMXSystemAppearanceService, LService) then
Result := LService.GetSystemThemeKind;
end;
TSystemThemeKind
声明的位置如下:
TSystemThemeKind = (Unspecified, Light, Dark);
IFMXSystemAppearanceService
目前支持 Android、iOS 和 macOS。