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

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

Features

  • A flat dark and light theme
  • Support PySide and PyQt
  • Support PyInstaller
  • Sync with OS's theme (Mac, Windows, Linux)
  • Resolve the style differences between Qt versions
  • Provide dark/light theme QPalette
  • Override Qt old standard icons

Themes

Dark Theme

widget_gallery_dark_theme

Light Theme

widget_gallery_light_them

Requirements

  • Python 3.7+
  • Qt 5.15+
  • 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)
# 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 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

qdarktheme.setup_theme("auto")

sync with os theme

Customizing colors

You can customize theme color.

# Customize accent color.
qdarktheme.setup_theme(custom_colors={"primary": "#D0BCFF"})

Further information for customizing color can be found in our theme color docs:

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 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.

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

Uploaded Source

Built Distribution

pyqtdarktheme-2.0.0-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file pyqtdarktheme-2.0.0.tar.gz.

File metadata

  • Download URL: pyqtdarktheme-2.0.0.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Linux/5.15.0-1024-azure

File hashes

Hashes for pyqtdarktheme-2.0.0.tar.gz
Algorithm Hash digest
SHA256 35415381dafd5dd82c9dddca1f917143beddcc004106fcf575c360698c0f9987
MD5 c6845d6c25cf8c8885aecf170433c325
BLAKE2b-256 80449c7635b7c43895b698ec11ce8416c25987d409e59dfd1b273b888e07301a

See more details on using hashes here.

File details

Details for the file pyqtdarktheme-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyqtdarktheme-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 52.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Linux/5.15.0-1024-azure

File hashes

Hashes for pyqtdarktheme-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 046ad89dfe4333d513573f26298dc413a69bb854a5916ca8d00ed655ca11cca4
MD5 a7cb1badc03704fb9613b4e8677d6fd7
BLAKE2b-256 a5ac24fa2d7bcdc0b89cf2e5956aef8e1c0bc3323b4414dc1d037fbd74069b86

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