Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for checking whether Dark Mode is enabled on OS X #4300

Closed
sindresorhus opened this issue Feb 1, 2016 · 1 comment
Closed

API for checking whether Dark Mode is enabled on OS X #4300

sindresorhus opened this issue Feb 1, 2016 · 1 comment

Comments

@sindresorhus
Copy link
Contributor

http://www.macworld.co.uk/how-to/mac-software/turn-on-yosemites-dark-mode-on-mac-3534690/

Dark Mode was introduced in OS X 10.10.

I'm thinking a method app.isDarkMode() and a app.on('dark-mode') event.

This is useful so you have the ability to make your app dark when Dark Mode is enabled.

For the method you could use:

NSString *mode = CFBridgingRelease(CFPreferencesCopyValue((CFStringRef)@"AppleInterfaceStyle", kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost));

And for the event, there's:

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(darkModeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];

-(void)darkModeChanged:(NSNotification *)notif {
    NSLog(@"Dark mode changed");
}

Similar to #1861, but this is IMHO a separate, and more actionable and focused request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants