Skip to main content

Flat dark theme for PySide and PyQt.

Project description

PyQtDarkTheme

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.

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

Tests
tests pre-commit.ci status codecov Total alerts

Features

  • A flat Dark and Light theme
  • Support PySide and PyQt
  • Support some freezing library(PyInstaller, cx_freeze, py2app and etc...)
  • Resolve the differences of style between Qt versions
  • QPalette of dark and light theme

Themes

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.9.tar.gz (54.6 kB view details)

Uploaded Source

Built Distribution

PyQtDarkTheme-0.1.9-py3-none-any.whl (101.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: PyQtDarkTheme-0.1.9.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.7.12 Darwin/20.6.0

File hashes

Hashes for PyQtDarkTheme-0.1.9.tar.gz
Algorithm Hash digest
SHA256 3d34bcdea4ce0ffdd4dd866e10ac6e0502c4a85b35f5b467add1365b306d7007
MD5 d602dc6be25acb44a0e2e6339ef387f8
BLAKE2b-256 b80c230699a03f55c17adc01645356db0821f436c268b6cb1a6733f43f7a038d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PyQtDarkTheme-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 101.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.7.12 Darwin/20.6.0

File hashes

Hashes for PyQtDarkTheme-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d80d1b670ad71e87d1b1bd3da22b41120e66c927a0d57853db250d1074b19b7c
MD5 b033297ec4d27c6af0165fd02446b90d
BLAKE2b-256 c114ef850c87ace0334cebbc88e4363593c8fca5a104126f9a9bf8b18283c14d

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