DEV Community

Md Ibrahim Hassan
Md Ibrahim Hassan

Posted on

How to force Light / Dark Mode in iOS?

Starting in iOS 13, Apple made a systemwide Dark Mode option available. There are cases when we might want to force only the light mode user interface. This can be done by adding the following entry to the Info.plist of the app.

<key>UIUserInterfaceStyle</key>
<string>Light</string>
Enter fullscreen mode Exit fullscreen mode

Similarly to force dark mode user interface:

<key>UIUserInterfaceStyle</key>
<string>Dark</string>
Enter fullscreen mode Exit fullscreen mode

UIUserInterfaceStyle has the following possible values:
1) Automatic (default value if we do not add UIUserInterfaceStyle key explicitly)
2) Light (forces light mode user interface)
3) Dark (forces dark mode user interface)

I hope this short post is helpful.
Happy coding :)

Top comments (0)