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 Total alerts Language grade: Python CodeFactor pre-commit.ci status codecov

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"))

QPalette of dark and light theme

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 program

To check example program, 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.7.tar.gz (54.7 kB view details)

Uploaded Source

Built Distribution

PyQtDarkTheme-0.1.7-py3-none-any.whl (99.6 kB view details)

Uploaded Python 3

File details

Details for the file PyQtDarkTheme-0.1.7.tar.gz.

File metadata

  • Download URL: PyQtDarkTheme-0.1.7.tar.gz
  • Upload date:
  • Size: 54.7 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.7.tar.gz
Algorithm Hash digest
SHA256 75708e22048cabe88cd117794d6d2e84b3357602407bc11460409ec6cf3255a0
MD5 2396eabb148297ba15054df774736a12
BLAKE2b-256 28703fa407676d0fe90209a8388e30b3778a5e855b4c104c8c48c55602ddbaf8

See more details on using hashes here.

File details

Details for the file PyQtDarkTheme-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: PyQtDarkTheme-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 99.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a454cfa1e4e1ef29703d8cf47158f77917428549a1cb1bb4f25affbb4a354195
MD5 4e18d9ce3e290a3cfe0f9f78aed6b29a
BLAKE2b-256 c319714755928eb68272853cb9eb4a2c694ec2d7c510f8a2685f688cf26324f2

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