Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check whether dark mode is enabled in iOS/iPadOS?

Starting from iOS/iPadOS 13, a dark user interface style is available, similar to the dark mode introduced in macOS Mojave. How can I check whether the user has enabled the system-wide dark mode?

like image 451
Tamás Sengel Avatar asked Jun 03 '19 23:06

Tamás Sengel


People also ask

How do I know if Dark Mode is enabled iOS?

Dark mode can be detected by using the userInterfaceStyle property on the current trait collection. When it's set to dark you know that the current appearance is set to dark.

Do all iPads have Dark Mode?

If you have an iPhone updated to iOS 13 or an Android phone that's updated to Android 10, your device will support system-wide dark mode. However, this still only applies to supported apps. Many other apps have their own dark modes that you will need to activate individually.

Why is there no Dark Mode on my iPad?

On your iPhone or iPad, navigate to Settings > Display & Brightness and tap the Dark theme under Appearance.

What version of iOS has Dark Mode?

The introduction of Dark Mode undoubtedly put a smile on the face of many Apple fans! We, iPhone, iPad, and iPod users have been begging for the feature for years! The good news for us iPhone and iPad folks is that dark mode finally made the cut in iOS 13 and iPadOS!


1 Answers

For iOS 13, you can use this property to check if current style is dark mode or not:

if #available(iOS 13.0, *) {     if UITraitCollection.current.userInterfaceStyle == .dark {         print("Dark mode")     }     else {         print("Light mode")     } } 
like image 164
huync Avatar answered Sep 27 '22 21:09

huync