How to disable Dark Mode for my app in Mojave?
Asked Answered
F

2

11

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?

Farmland answered 25/9, 2018 at 23:35 Comment(0)
H
14

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.

Hemihedral answered 26/9, 2018 at 1:5 Comment(1)
Awesome, perfect answer.Farmland
B
7
if (@available(macOS 10.14, *))
{
    NSApp.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua];
}

See documentation.

Bonnee answered 26/9, 2018 at 1:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.