darkdetect
Detect OS Dark Mode from Python
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
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 · maintenance · safety
BSD-3-Clause (permissive) — 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.
last release 2022-12-16 (1337 days) · last repo commit 2024-03-11 · 225 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,369,936 downloads/mo, #3,994 on PyPI
Alternatives
Verify before relying
pip install darkdetect
import darkdetect
if darkdetect.isDark():
print('Dark mode is active')
else:
print('Light mode is active')- 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).
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 on this page. Verify before relying on it.
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
darkdetect on PyPI
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 the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 1,337 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,369,936 / month, #3,994 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: BSD LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: Windows :: Windows 10Operating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: darkdetect-0.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “detect dark mode os”
- darkdetectDetects whether the operating system is in Dark Mode on macOS 10.14+,…
- st-themeDetects and returns the active theme (light or dark) of a running…
- sphinx-rtd-dark-modeAdds a toggleable dark mode interface to Sphinx documentation built…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also sv-ttk · st-theme · QDarkStyle · sphinx-rtd-dark-mode · ttkbootstrap · qt-material · desktop-notifier · notify2 · colorclass · detect-installer