app_desktop_darwin.m 529 B

123456789101112131415161718
  1. //go:build !ci && !ios
  2. // +build !ci,!ios
  3. extern void themeChanged();
  4. #import <Foundation/Foundation.h>
  5. bool isDarkMode() {
  6. NSString *style = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
  7. return [@"Dark" isEqualToString:style];
  8. }
  9. void watchTheme() {
  10. [[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"AppleInterfaceThemeChangedNotification" object:nil queue:nil
  11. usingBlock:^(NSNotification *note) {
  12. themeChanged(); // calls back into Go
  13. }];
  14. }