PyQtDarkTheme applies a flat dark theme to QtWidgets application(PySide and PyQt). There's a light theme too. Color and style balanced from a dark theme for easy viewing in daylight.
Check out the complete documentation.
- A flat dark and light theme
- Support PySide and PyQt
- Support PyInstaller
- Resolve the style differences between Qt versions
- QPalette of dark and light theme
- Python 3.7+
- Qt 5.11+
- PySide6, PyQt6, PyQt5 or PySide2
-
Last released version
pip install pyqtdarktheme
-
Latest development version
pip install git+https://github.com/5yutan5/PyQtDarkTheme.git@main
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
import qdarktheme
app = QApplication(sys.argv)
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)
# Apply dark theme to Qt application
app.setStyleSheet(qdarktheme.load_stylesheet())
main_win.show()
app.exec()
⚠ The image quality may be lower on Qt5(PyQt5, PySide2) due to the use of svg. You can add the following attribute to improve the quality of images.
app.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps)
app.setStyleSheet(qdarktheme.load_stylesheet("light"))
You can get color of dark and light theme by loading QPalette. To load palette, run:
palette = qdarktheme.load_palette()
# or
palette = qdarktheme.load_palette("light")
For example, you can apply a link color to your application.
import sys
from PyQt5.QtGui import QPalette
from PyQt5.QtWidgets import QApplication
import qdarktheme
app = QApplication(sys.argv)
dark_palette = qdarktheme.load_palette()
palette = app.palette()
palette.setColor(QPalette.ColorRole.Link, dark_palette.link().color())
app.setPalette(palette)
Further information can be found in our docs:
You can change the border corner style.
# Default is "rounded".
stylesheet = qdarktheme.load_stylesheet(border="sharp")
To check example app, run:
python -m qdarktheme.widget_gallery
The svg files for the PyQtDarkTheme are derived Material design icons(Apache License Version 2.0). Qt stylesheets are originally fork of QDarkStyleSheet(MIT License). Other files are covered by PyQtDarkTheme's MIT license.
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. You can get started by reading this:
See Releases.