title: How to detect if OSX in dark or light mode in Auto Appearance Mode in Catalina
body: <p>My Mac app needs to change behaviour depending on light or dark mode.</p>
  
  <p>Whats the best way to detect style when Appearance option is selected to auto in macOS Catalina?</p>
  
  <pre><code>NSDictionary *dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:NSGlobalDomain];
  id style = [dict objectForKey:@"AppleInterfaceStyle"];
  
  BOOL darkModeOn = ( style &amp;&amp; [style isKindOfClass:[NSString class]] &amp;&amp; NSOrderedSame == [style caseInsensitiveCompare:@"dark"] );
  </code></pre>
  
  <p>darkModeOn is still yes/dark even after switching from dark to auto appearance option.</p>