Skip to main content

Detect macOS Mojave Dark Mode from Python

Project description

Darkdetect

This package allows to detect if macOS 10.14+ is running with the Dark Mode enabled. 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.

Usage

import darkdetect

>>> darkdetect.theme()
'Dark'

>>> darkdetect.isDark()
True

>>> darkdetect.isLight()
False

It's that easy.

Install

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.

Notes

  • 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 None unless executed on macOS 10.14 Mojave or newer versions. This package is designed to work also with older versions of macOS and in those cases it will also return None. Detection of the dark menu bar and dock option (available from 10.10) is not supported.
  • Details on the detection method used.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for darkdetect, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size darkdetect-0.1.1-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size darkdetect-0.1.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page