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.

Check out the complete documentation.

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

Tests
tests pre-commit.ci status codecov Total alerts Documentation Status

Features

  • A flat Dark and Light theme
  • Support PySide and PyQt
  • Support some freezing library(PyInstaller, cx_Freeze 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

  • Python 3.7+
  • Qt 5.11+
  • PySide6, PyQt6, PyQt5 or PySide2

Installation Method

  • Last released version

    pip install pyqtdarktheme
    
  • 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)
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)

# Default is dark theme
app.setStyleSheet(qdarktheme.load_stylesheet())

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()
# or
palette = 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)

Further information can be found in our docs:

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.

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


Download files

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

Source Distribution

PyQtDarkTheme-1.0.1.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

PyQtDarkTheme-1.0.1-py3-none-any.whl (97.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: PyQtDarkTheme-1.0.1.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.11.0-1022-azure

File hashes

Hashes for PyQtDarkTheme-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8948f26e9d69c54546bc498026ff0ab5d8a6eac04aeb3038bdb2d605642843c2
MD5 78549fe1b535cf0e7857250188930610
BLAKE2b-256 2e6f45f73e215957b0450f25110bfb8b2d755060346f297ff42492efdb24bb5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PyQtDarkTheme-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 97.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.11.0-1022-azure

File hashes

Hashes for PyQtDarkTheme-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c77168ee3e458c6a1ed7828031da513901225720cb38ad0f5cb098ea7f0479a2
MD5 d0b06716280fd605e222c3b8a2e85f0e
BLAKE2b-256 9cd1a554831e3a01db012c0d46ded876830c6cf9e67d24c56337256d3de37d47

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