unit Core.MacOS.DarkMode;
{$MODESWITCH OBJECTIVEC1}
interface
uses
Classes, SysUtils, CocoaAll, MacOsAll;
implementation
type
TThemeChangedNotification = objcclass(NSObject)
procedure ThemeChangedNotification(notification: NSNotification);
message 'ThemeChangedNotification:';
end;
procedure TThemeChangedNotification.ThemeChangedNotification(
notification: NSNotification);
begin
// This will be triggered upon theme change
end;
var
ThemeChangedNotification: TThemeChangedNotification;
DistributedNotificationCenter: NSDistributedNotificationCenter;
initialization
ThemeChangedNotification := TThemeChangedNotification.alloc.init;
ThemeChangedNotification.retain;
DistributedNotificationCenter := NSDistributedNotificationCenter.defaultCenter;
if Assigned(DistributedNotificationCenter) then
DistributedNotificationCenter.addObserver_selector_name_object(
ThemeChangedNotification, ObjCSelector('ThemeChangedNotification:'),
NSSTR('AppleInterfaceThemeChangedNotification'), nil);
finalization
ThemeChangedNotification.release;
end.