---
title: Dark Mode on remote devices | TestingBot
description: Toggle dark mode and light mode on iOS simulators, Android emulators
  and real devices during Appium tests on the TestingBot cloud.
source_url:
  html: https://testingbot.com/support/app-automate/appium/dark-mode
  md: https://testingbot.com/support/app-automate/appium/dark-mode.md
---

# Dark Mode testing with Appium

Dark mode is a setting, available on both Android and iOS, which toggles the interface appearance of the phone to use either the standard light mode setting or a dark mode.

When dark mode is enabled, the phone will switch to a dark background with lighter foreground colors, which enables better viewing in low-light conditions.

## Changing Dark Mode

This example will use `mobile: setAppearance` to set the appearance to dark (dark mode).

[Android](https://testingbot.com#) [iOS](https://testingbot.com#)

```javascript
const { remote } = require('webdriverio');

const capabilities = {
  'platformName': 'Android',
  'appium:app': 'https://testingbot.com/appium/sample.apk',
  'appium:deviceName': 'Pixel 8',
  'appium:platformVersion': '14.0',
  'appium:automationName': 'UiAutomator2',
  'tb:options': {
    'name': 'Dark Mode Test',
    'realDevice': true
  }
};

(async () => {
  const driver = await remote({
    hostname: 'hub.testingbot.com',
    port: 443,
    protocol: 'https',
    path: '/wd/hub',
    user: 'api_key',
    key: 'api_secret',
    capabilities
  });

  // Enable dark mode
  await driver.execute('mobile: setAppearance', { style: 'dark' });

  const inputA = await driver.$('~inputA');
  await inputA.setValue('10');

  const inputB = await driver.$('~inputB');
  await inputB.setValue('5');

  const sum = await driver.$('~sum');
  const value = await sum.getText();
  console.assert(value === '15', 'Sum should be 15');

  await driver.deleteSession();
})();
```

Make sure to always stop your test (`driver.deleteSession()`), otherwise it will continue running, leading to a timeout.

```javascript
const { remote } = require('webdriverio');

const capabilities = {
  'platformName': 'iOS',
  'appium:app': 'https://testingbot.com/appium/sample.ipa',
  'appium:deviceName': 'iPhone 15',
  'appium:platformVersion': '17.0',
  'appium:automationName': 'XCUITest',
  'tb:options': {
    'name': 'Dark Mode Test',
    'realDevice': true
  }
};

(async () => {
  const driver = await remote({
    hostname: 'hub.testingbot.com',
    port: 443,
    protocol: 'https',
    path: '/wd/hub',
    user: 'api_key',
    key: 'api_secret',
    capabilities
  });

  // Enable dark mode
  await driver.execute('mobile: setAppearance', { style: 'dark' });

  const inputA = await driver.$('~inputA');
  await inputA.setValue('10');

  const inputB = await driver.$('~inputB');
  await inputB.setValue('5');

  await driver.deleteSession();
})();
```

Make sure to always stop your test (`driver.deleteSession()`), otherwise it will continue running, leading to a timeout.

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new) [Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
