Dark theme for PySide and PyQt.
This python module applies a theme to a Qt applications(PySide6, PyQt6, PyQt5) using a qt stylesheets system.
There's a Light Theme too. Color and style balanced from the Dark theme for easy viewing in daylight.
- Python 3.9+
- Windows or MacOS (recommended)
- PySide6, PyQt6 or PyQt5 (PyQt5 is deprecated)
This module tested on Windows and MacOS. It may work on other operating systems, but it is not guaranteed to work. It also supports PyQt5, but the icons are low quality.
pip install git+https://github.com/5yutan5/PyQtDarkTheme
This command requires Git.
import sys
import qdarktheme
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
app = QApplication(sys.argv)
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)
app.setStyleSheet(qdarktheme.load_stylesheet())
main_win.show()
app.exec()
app.setStyleSheet(qdarktheme.load_stylesheet("light"))
Input the following command in a terminal to check common widgets.
python -m qdarktheme.examples.widget_gallery
This module provides several custom properties.
You can use setProperty()
of the widget object to apply a modern style.
For example, if you set the QToolbar type
property to sidebar
, the style for the sidebar will be applied.
sidebar = QToolBar()
sidebar.setProperty("type", "sidebar")
Widget | Property | Property value | Default | Command for demo |
---|---|---|---|---|
QToolBar | type | toolbar, sidebar | toolbar | python -m qdarktheme.examples.sidebar |
QPushButton | type | outlined, contained, text | outlined | python -m qdarktheme.examples.pushbutton |
QLineEdit | state | normal, warning, error | normal | python -m qdarktheme.examples.lineedit |
The icons used in the demo code are sourced from the Material design icons(Apache License Version 2.0).