Dark mode is a display setting for user interfaces (UI) to toggle between either showing dark text on a light background, or showing light text on a dark background. It is designed to reduce eye strain, particularly in low-light environments, by minimizing the amount of light emitted by the device's screen.
Switching between light mode and dark mode is often a preferred option for people who spend a lot of time using electronic devices, as it can reduce the amount of blue light emitted by the screen at night, which can interfere with sleep patterns.
Dark mode settings are available in most modern handheld devices. It aids in extending the battery life of these devices, especially with OLED or AMOLED screens, as these displays use less power to produce black pixels than white ones.
Why should I do dark-mode testing?
Automated testing on mobile devices with dark mode settings can help ensure that an application or website is fully functional and optimized for both light and dark display modes.
Testing both modes can help identify any display issues or user experience problems that may arise when switching between the modes. For example, you want to make sure that the color of your text is always legible, depending on the background of the text. If your app uses a black color for text, but switches to a dark background in dark mode as well, the text may no longer be legible.
By utilising automated dark mode testing, you can test for certains things such as:
Lack of contrast:
Some color combinations may be less visible or distinguishable in a dark mode setting, or in light-mode (default mode).
Check all screens in your mobile app to see if dark mode is implemented correctly. You may have forgotten to add dark mode to some parts of your app.
Automatically switch dark/light mode:
Make sure your mobile app knows when to switch to dark or light mode, depending on the Operating System's preferences.
How to run dark mode and light mode tests with Appium?
Appium is an open-source mobile testing framework that allows you to run automated tests against native mobile iOS and Android apps.
With Appium, you can use
mobile:setAppearance for iOS (XCUITest) and either specify a style of dark or light:
You can specify either
lightas a style
On Android, you can use the following command to toggle dark mode on the device:
Where you specify either
no to change the dark mode settings.
Common issues when implementing dark mode in a mobile app.
Below are some of the most common issues when first implementing dark mode in a mobile iOS or Android app.
Some UI elements may not have enough contrast against a dark or light background, making these difficult to read or interact with.
Certain graphics used in your app may not look as good in dark mode as they would in light mode. You may have to change the graphic to make sure it looks good in both modes.
Some third party libraries that your app might be using, may not (yet) support dark mode. This might cause visible glitches or inconsistencies in your UI.