# Dark Mode

DevFeed: [Dark Mode](<https://devfeed.tech/articles/dark-mode-19277.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/dark-mode/>)

Author: Shai Almog

Published: 2020-06-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [Dark Mode](<https://devfeed.tech/topics/dark-mode.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [css](<https://devfeed.tech/tags/css.md>), [dark-mode](<https://devfeed.tech/tags/dark-mode.md>), [ios](<https://devfeed.tech/tags/ios.md>)

## AI overview

This article explains how Codename One detects dark mode, including the isDarkMode() and setDarkMode(Boolean) APIs, platform limitations, and methods for applying dark themes and CSS resources.

## Source excerpt

We recently added support to detect whether a device is running in dark/light mode based on this issue. Some of the code in the implementation is also derived from that issue submitted by Javier. Detecting Dark Mode Dark mode can be detected using APIs in the CN and Display classes. Specifically isDarkMode() and setDarkMode(Boolean). Notice that isDarkMode() returns Boolean and not boolean. This means that null is a valid value for this method. The case of null indicates that dark mode detection isn't available or isn't working on this platform.