Skip to main content
Logo Appt Light

Dark mode on iOS

Dark mode darkens background colours and provides a more comfortable viewing experience in low light. This is essential for many visually impaired people since a light background colour can be painful or even impossible to look at for an extended period of time. But also people who have problems with their concentration, for example due to a brain disorder, benefit greatly from dark mode.

On iOS, you can detect dark mode by checking if the userInterfaceStyle has been set to .dark.

You can provide dark mode resources to let iOS automatically use the right resources. For example, inside Assets.xcassets you can add a Dark version for colors and images.

func isInDarkMode() -> Bool{
    if #available(iOS 12.0, *) {
        if UIScreen.main.traitCollection.userInterfaceStyle == .dark {
            return true
        }
    }
    return false
}

Feedback?

Let us know!