--- id: darkdetect version: "0.8.0" license: BSD-3-Clause license_treatment: permissive maintenance: dormant --- # darkdetect — Detect OS Dark Mode from Python License: permissive · Maintenance: dormant · Downloads: 1.4M/mo ## What it is and what it does Darkdetect is a lightweight, dependency-free library that queries the operating system to determine whether Dark Mode is currently active. It works on macOS 10.14+, Windows 10 1607+, and Linux systems with dark GTK themes, returning a simple boolean or string indicating the current theme. The package is designed for GUI application developers who need to adapt their interface colors to match the system theme, particularly when their GUI framework does not expose a native dark mode detection API. The library provides three main functions: `theme()` returns the string 'Dark' or 'Light', `isDark()` and `isLight()` return booleans. It also offers a `listener()` function that runs as a daemon thread to monitor for OS theme changes and invoke a callback when the user switches modes. Because it has no external dependencies beyond the Python standard library, it can be vendored directly into applications if needed. Use it for: - Adapt a Tkinter, wxPython, or PyQt GUI to match the system dark mode without relying on the GUI framework's own detection API. - Monitor for live theme switches and update application colors in real time via a background listener thread. - Conditionally load light or dark stylesheets or color palettes at application startup based on the current OS theme. - Build cross-platform desktop tools that respect user accessibility and appearance preferences on macOS, Windows, and Linux. - Vendor darkdetect into a standalone application to avoid external package dependencies while still supporting dark mode detection. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Detects whether the operating system is in Dark Mode on macOS 10.14+, Windows 10 1607+, and Linux with dark GTK themes, and optionally monitors for theme changes. Yes, if you are building a GUI application on macOS, Windows, or Linux and need to detect or respond to the system dark mode. The package is lightweight, has no dependencies, and solves a real problem for frameworks that do not expose dark mode detection. Maintenance is dormant but the package is stable and has no known vulnerabilities; install it as a utility library rather than expecting active development. ## Install pip install darkdetect uv add darkdetect poetry add darkdetect ## Installing darkdetect Before you install: Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant (last commit 2024-03-11, 1337 days since release), but the package is stable and archived status is false. License in practice: BSD-3-Clause is permissive; you may use, modify, and distribute this package freely in commercial or open-source projects provided you include the license notice. Quickstart: pip install darkdetect import darkdetect if darkdetect.isDark(): print('Dark mode is active') else: print('Light mode is active') Verify before relying: - Whether the macOS listener (optional install darkdetect[macos-listener]) requires additional system libraries or frameworks beyond what the base package provides. - Exact behavior and return values when run on unsupported OS versions or systems without dark mode support (documentation states it returns None but does not specify all edge cases). ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags detect dark mode os, dark theme detection, system dark mode python, gui dark mode listener, os theme detection, macos windows linux dark mode, dark-mode-detection, gui-theming, cross-platform [View on SkillFed](https://skillfed.io/packages/darkdetect) · [View on PyPI](https://pypi.org/project/darkdetect/)