Flat dark theme for PySide, PyQt.
Project description
PyQtDarkTheme
Project status
Tests
Dark and Light theme for PySide and PyQt.
PyQtDarkTheme applies a flat dark theme to PySide and PyQt. There's a light theme too. Color and style balanced from a dark theme for easy viewing in daylight.
Features:
- A modern Dark and Light theme
- Support PySide and PyQt(Qt5, Qt6)
- Support some freezing library(PyInstaller, cx_freeze, py2app and etc...)
- Resolve the differences of style between Qt versions
- QPalette of dark and light theme
Dark Theme
Light Theme
Requirements
- Python 3.7+
- PySide6, PyQt6, PyQt5 or PySide2
Installation Method
- Last released version
pip install pyqtdarktheme
- Latest development version
pip install git+https://github.com/5yutan5/PyQtDarkTheme
Usage
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)
# Default is dark theme
app.setStyleSheet(qdarktheme.load_stylesheet())
# qdarktheme.load_stylesheet("dark")
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)
Light theme
app.setStyleSheet(qdarktheme.load_stylesheet("light"))
Dark and Light palette
You can get color of dark and light theme by loading QPalette. To load palette, run:
palette = qdarktheme.load_palette()
# qdarktheme.load_palette("dark")
# qdarktheme.load_palette("light")
For example, you can apply a link color to your application.
import sys
from PyQt6.QtGui import QPalette
from PyQt6.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)
Example
To check example app, run:
python -m qdarktheme.widget_gallery
License
The svg file 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file PyQtDarkTheme-0.1.8.tar.gz
.
File metadata
- Download URL: PyQtDarkTheme-0.1.8.tar.gz
- Upload date:
- Size: 55.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6547c7ed090eca3ef6ad5c9dc31b6d1b93a625026d63e72c416f1794f24ab7f1 |
|
MD5 | 7b96dba8d763192d211cbd85120ff94a |
|
BLAKE2b-256 | ae03787e8f85fc0969c5f60ff0a8e5a3db3d01fa95b1beea91ccf304caba8b5c |
File details
Details for the file PyQtDarkTheme-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: PyQtDarkTheme-0.1.8-py3-none-any.whl
- Upload date:
- Size: 100.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5e1acfb322806405ce41ede1fe974e797c5d6e4ead0e5359afef4e75a341c1f |
|
MD5 | 52dac6e9efc9f0a34879b01368b50f73 |
|
BLAKE2b-256 | 42548c2dbd17b8c64b84376c240a0011e137b6911eb9db4e3c21d01b5ec498ff |