Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Dark Mode for my app in Mojave?

When I build my macOS app in Xcode 10 under Mojave, it automatically makes my app adopt Dark Mode. I am not ready yet to implement Dark Mode for my app.

How do I disable Dark Mode for my app, so it appears aqua in both the light and dark mode under macOS?

like image 309
Eric Avatar asked Sep 25 '18 23:09

Eric


People also ask

How do I turn off Dark Mode for certain apps?

On your phone, open the Settings app. Tap Display. Turn Dark theme on or off.

How do I turn off dark app mode on Mac?

Dark mode can also be quickly enabled from Control Center. Click the switch icon in the menu bar and click Display, then choose Dark Mode to switch the feature on and off.

How do I permanently turn off Dark Mode?

Start by running the Google Search app on your device and then navigate to the More button. Next, click on Settings. In the Settings screen, go to Themes. A screen will allow you to choose between the Dark, Light, and System default settings.

How do I change Mojave to Light Mode?

First, to turn Dark mode on, go to System Preferences > General and click the Dark thumbnail to the right of Appearance. Mojave immediately switches to Dark mode, turning light backgrounds dark and swapping the text color from dark to light.


2 Answers

if (@available(macOS 10.14, *))
{
    NSApp.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua];
}

See documentation.

like image 200
DDP Avatar answered Nov 14 '22 15:11

DDP


From Supporting Dark Mode in Your Interface: Choosing a Specific Appearance for Your App – Opt Out of Dark Mode:

Apps linked against macOS 10.14 or later should support both light and dark appearances. […]

If you need extra time to work on your app's Dark Mode support, you can temporarily opt out by including the NSRequiresAquaSystemAppearance key (with a value of YES) in your app’s Info.plist file. Setting this key to YES causes the system to ignore the user's preference and always apply a light appearance to your app.

like image 14
Ken Thomases Avatar answered Nov 14 '22 16:11

Ken Thomases