This package allows to detect if the user is using Dark Mode on:
The main application of this package is to detect the Dark mode from your GUI Python application (Tkinter/wx/pyqt/qt for python (pyside)/...) and apply the needed adjustments to your interface. Darkdetect is particularly useful if your GUI library does not provide a public API for this detection (I am looking at you, Qt). In addition, this package does not depend on other modules or packages that are not already included in standard Python distributions.
import darkdetect >>> darkdetect.theme() 'Dark' >>> darkdetect.isDark() True >>> darkdetect.isLight() False
It's that easy.
The preferred channel is PyPI:
pip install darkdetect
Alternatively, you are free to vendor directly a copy of Darkdetect in your app. Further information on vendoring can be found here.
- This software is licensed under the terms of the 3-clause BSD License.
- This package can be installed on any operative system, but it will always return
Noneunless executed on a OS that supports Dark Mode, including older versions of macOS and Windows.
- On macOS, detection of the dark menu bar and dock option (available from macOS 10.10) is not supported.
- Details on the detection method used on macOS.
- Details on the experimental detection method used on Linux.