{"id":7649,"library":"qdarkstyle","title":"QDarkStyleSheet","description":"QDarkStyleSheet (qdarkstyle) provides a comprehensive dark and light stylesheet for C++/Python Qt applications. It offers a consistent, modern theme for your GUI, compatible with both PyQt5 and PySide2. The current version is 3.2.3, and it receives regular minor updates with occasional major releases for significant structural changes and new features.","status":"active","version":"3.2.3","language":"en","source_language":"en","source_url":"https://github.com/ColinDuquesnoy/QDarkStyleSheet","tags":["qt","gui","stylesheet","dark-mode","pyside","pyqt","theming"],"install":[{"cmd":"pip install qdarkstyle","lang":"bash","label":"Install qdarkstyle"}],"dependencies":[],"imports":[{"note":"While `load_stylesheet()` exists, using the binding-specific `load_stylesheet_pyqt5()` or `load_stylesheet_pyside2()` is generally recommended for clarity and directness.","wrong":"app.setStyleSheet(qdarkstyle.load_stylesheet())","symbol":"load_stylesheet_pyqt5","correct":"import qdarkstyle\napp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())"},{"note":"While `load_stylesheet()` exists, using the binding-specific `load_stylesheet_pyqt5()` or `load_stylesheet_pyside2()` is generally recommended for clarity and directness.","wrong":"app.setStyleSheet(qdarkstyle.load_stylesheet())","symbol":"load_stylesheet_pyside2","correct":"import qdarkstyle\napp.setStyleSheet(qdarkstyle.load_stylesheet_pyside2())"}],"quickstart":{"code":"import sys\nfrom PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget\nfrom PyQt5.QtCore import Qt\n\nimport qdarkstyle\n\ndef main():\n    app = QApplication(sys.argv)\n\n    # Apply the dark stylesheet for PyQt5\n    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())\n    # For PySide2, use:\n    # app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2())\n\n    # Create a simple main window\n    main_window = QMainWindow()\n    main_window.setWindowTitle(\"QDarkStyle Demo\")\n    main_window.setGeometry(100, 100, 400, 200)\n\n    central_widget = QWidget()\n    main_window.setCentralWidget(central_widget)\n    layout = QVBoxLayout(central_widget)\n\n    button = QPushButton(\"Styled Button\", main_window)\n    layout.addWidget(button, alignment=Qt.AlignCenter)\n\n    main_window.show()\n    sys.exit(app.exec_())\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to initialize a PyQt5 application and apply the QDarkStyleSheet. Ensure you have PyQt5 (or PySide2) installed alongside qdarkstyle. The example creates a simple window with a button to showcase the applied theme."},"warnings":[{"fix":"Ensure your project uses Python 3.6+ and Qt5 (PyQt5 or PySide2).","message":"QDarkStyleSheet dropped support for Python 2 and Qt4. Attempting to use it with these older versions will result in errors or unexpected behavior.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Refer to the official GitHub repository's `example` folder and release notes for `v3.0.0` to understand the new structure and usage patterns. Most common usage (`app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())`) remains compatible.","message":"Version 3.0.0 introduced a new internal structure, improved dark and new light palettes. If you were relying on deeply integrated custom styling or internal API calls prior to 3.0.0, you might need to adapt your code.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Install your preferred Qt binding: `pip install PyQt5` or `pip install PySide2`.","message":"QDarkStyleSheet provides stylesheets but does not install Qt bindings (PyQt5 or PySide2) itself. You must explicitly install one of these bindings for `qdarkstyle` to function.","severity":"gotcha","affected_versions":"*"},{"fix":"If using PyQt5, call `qdarkstyle.load_stylesheet_pyqt5()`. If using PySide2, call `qdarkstyle.load_stylesheet_pyside2()`.","message":"Ensure you are using the correct `load_stylesheet_pyqt5()` or `load_stylesheet_pyside2()` function that matches your installed Qt binding.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run: `pip install qdarkstyle`","cause":"The qdarkstyle library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'qdarkstyle'"},{"fix":"Run: `pip install PyQt5` (or `pip install PySide2` if you prefer PySide2).","cause":"You are trying to use PyQt5 but it is not installed. This is a prerequisite for qdarkstyle.","error":"ModuleNotFoundError: No module named 'PyQt5'"},{"fix":"Ensure `qdarkstyle` is updated (`pip install --upgrade qdarkstyle`) and verify you are calling the correct function for your binding (e.g., `load_stylesheet_pyqt5()` for PyQt5 or `load_stylesheet_pyside2()` for PySide2).","cause":"This usually means you're trying to use a binding-specific function (e.g., for PyQt5) but either an older version of qdarkstyle is installed, or you're using a generic loader that doesn't support the specific function, or the wrong binding's function name is used.","error":"AttributeError: module 'qdarkstyle' has no attribute 'load_stylesheet_pyqt5'"}]}