Flat dark theme for PySide and PyQt.
Project description
Fork Purpose
This repository performs the following:
- Includes fixes to run on newer Python versions
- Publishes to PyPi as
pyqtdarktheme-fork
PyQtDarkTheme
PyQtDarkTheme applies a flat dark theme to QtWidgets application. There's a light theme too. Color balanced from the dark theme for easy viewing in daylight.
Check out the complete documentation.
Features
- A flat dark and light theme
- Support PySide and PyQt
- Sync with OS's theme and accent (Mac, Windows, Linux)
- Resolve the style differences between Qt versions
- Provide dark/light theme QPalette
- Override Qt old standard icons
Themes
Dark Theme
Light Theme
Requirements
- Python 3.8+
- Qt 5.15+
- PySide6, PyQt6, PyQt5 or PySide2
Installation Method
-
Last released version
pip install pyqtdarktheme-fork
-
Latest development version
pip install git+https://github.com/5yutan5/PyQtDarkTheme.git@main
Usage
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
import qdarktheme
app = QApplication(sys.argv)
# Apply the complete dark theme to your Qt App.
qdarktheme.setup_theme()
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)
main_win.show()
app.exec()
Further information can be found in our docs:
Enable HiDPI
# enable_hi_dpi() must be called before the instantiation of QApplication.
qdarktheme.enable_hi_dpi()
app = QApplication(sys.argv)
qdarktheme.setup_theme()
For Qt6 bindings, HiDPI “just works” without using this function.
Light theme
qdarktheme.setup_theme("light")
Sync with OS's theme and accent
qdarktheme.setup_theme("auto")
On macOS, qdarktheme also syncs with accent colors.
Customizing colors
You can customize the theme color.
# Customize accent color.
qdarktheme.setup_theme(custom_colors={"primary": "#D0BCFF"})
For a list of all customizable colors, see the Theme Color Reference:
Sharp frame
You can change the corner style.
# Default is "rounded".
stylesheet = qdarktheme.setup_theme(corner_shape="sharp")
QPalette and stylesheet
You can also only load QPalette and stylesheet. qdarktheme.setup_theme
uses the following functions internally.
palette = qdarktheme.load_palette(theme="dark")
stylesheet = qdarktheme.load_stylesheet(theme="dark")
Example
To check all Qt widgets, run:
python -m qdarktheme.widget_gallery
License
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. The accent detector(qdarktheme/_os_appearance/_accent/_mac_detect) is inspired by darkdetect(3-clause BSD License).
Contributing
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. You can get started by reading this:
Change log
See Releases.
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_fork-2.3.2.tar.gz
.
File metadata
- Download URL: pyqtdarktheme_fork-2.3.2.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ea94fed5df262d960378409357c63032639f749794d766f41a45ad8558b2523 |
|
MD5 | c675a67960a61b07f39019e0678f7a04 |
|
BLAKE2b-256 | 658be7e525927257ecab3a372fb8791197f1f707ff7b4a3b8dd1dcceb3e0f860 |
File details
Details for the file pyqtdarktheme_fork-2.3.2-py3-none-any.whl
.
File metadata
- Download URL: pyqtdarktheme_fork-2.3.2-py3-none-any.whl
- Upload date:
- Size: 54.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d96ee64f0884678fad9b6bc352d5e37d84ca786fa60ed32ffaa7e6c6bc67e964 |
|
MD5 | 8fbd424ace120b9be56705c51c82bf9d |
|
BLAKE2b-256 | 4d068a77ddbc37efd415602237fbb9685e0a52e112d31dfc3a7cb28c8656dd2c |