Skip to main content

Flat dark theme for PySide, PyQt.

Project description

PyQtDarkTheme

Project status

PyPI Latest Release Python Versions Qt Versions License Code style: black

Tests

tests codeql pre-commit.ci status codecov Total alerts Language grade: Python CodeFactor Codacy Badge

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

widget_gallery_dark_theme

Light Theme

widget_gallery_light_them

Requirements

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyQtDarkTheme-0.1.8.tar.gz (55.0 kB view details)

Uploaded Source

Built Distribution

PyQtDarkTheme-0.1.8-py3-none-any.whl (100.4 kB view details)

Uploaded Python 3

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

Hashes for PyQtDarkTheme-0.1.8.tar.gz
Algorithm Hash digest
SHA256 6547c7ed090eca3ef6ad5c9dc31b6d1b93a625026d63e72c416f1794f24ab7f1
MD5 7b96dba8d763192d211cbd85120ff94a
BLAKE2b-256 ae03787e8f85fc0969c5f60ff0a8e5a3db3d01fa95b1beea91ccf304caba8b5c

See more details on using hashes here.

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

Hashes for PyQtDarkTheme-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e1acfb322806405ce41ede1fe974e797c5d6e4ead0e5359afef4e75a341c1f
MD5 52dac6e9efc9f0a34879b01368b50f73
BLAKE2b-256 42548c2dbd17b8c64b84376c240a0011e137b6911eb9db4e3c21d01b5ec498ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page