Skip to main content

qtass-pyside6

Qt Advanced Stylesheets for PySide 6

PyPI version Python Version

This is the Python version of the Qt Advanced Stylesheets Project for C++.

The library allows runtime color switching for CSS stylesheet themes including SVG resources and SVG icons. The image below shows switching of accent color and switching between dark and light theme. Notice how the icons in the left sidebar change color when switching between dark and light theme.

color_switching

The main features are:

  • runtime switching of CSS colors
  • runtime color switching of CSS SVG icons / resources
  • runtime color switching of icons loaded via loadThemeAwareSvgIcon()
  • runtime switching of QPalette colors
  • definition of CSS styles that switch the complete application design
  • definition of XML color themes that allow switching of theme colors (dark / light)
  • switching of individual theme color or switching of accent color
  • QML support

📦 Installation

Install from PyPI:

pip install qtass-pyside6

Accent color sources (1.0.0)

The existing accentColor variable now supports three sources. Theme selection (Dark/Light) and accent selection are independent.

from PySide6.QtGui import QColor
from qtass import AccentSource, QtAdvancedStylesheet

style = QtAdvancedStylesheet()  # construct before applying your own palette
style.set_current_style("metro")
style.set_current_theme("dark_orange")
style.set_accent_color(QColor("#4169e1"))  # selects CUSTOM
style.set_accent_source(AccentSource.SYSTEM)
style.set_accent_source(AccentSource.THEME)  # restore current XML theme's accent

THEME is the backwards-compatible default. CUSTOM survives subsequent theme switches. SYSTEM reads Windows' native accent and tracks its changes without reading back QtASS' own application palette. Unavailable system colors fall back to the current theme; on other platforms the initial native Qt accent palette is used as a snapshot. Construct the style before replacing the application's palette.

accent_color() returns the effective QColor. accent_color_changed(QColor) and accent_source_changed(AccentSource) expose changes. Invalid custom colors are rejected before changing the policy. Selecting CUSTOM without a saved custom color raises ValueError. set_theme_variable_value("accentColor", value) also selects persistent CUSTOM mode; call update_stylesheet() afterwards as before.

New accent setters and native change notifications refresh CSS, palette and SVG resources and apply the generated stylesheet to QApplication. Existing explicit update_stylesheet() callers continue applying style.stylesheet themselves. Keep Qt calls on the GUI thread. Native Windows event callbacks are queued there automatically. Native subscriptions are released on style destruction/application exit.

Applications own preference storage: persist the chosen source and custom color in per-user settings, not in shared theme XML files. QtASS does not change system personalization settings or automatically persist application preferences.

For tests or alternative platforms, subclass qtass.system_accent.AccentProvider, implement color() -> QColor, and emit its changed(QColor) signal on the GUI thread. Pass the instance as QtAdvancedStylesheet(accent_provider=provider). The caller owns an injected provider; the default native provider is style-owned.

Run regression checks with:

python -m unittest discover -s tests -v

Metadata

Release files for qtass-pyside6 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qtass-pyside6 1.0.0
File Size Uploaded Provenance Actions
qtass_pyside6-1.0.0.tar.gz 1.6 MB Without provenance Details for qtass_pyside6-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qtass-pyside6 1.0.0
File Interpreter ABI Platform Actions
qtass_pyside6-1.0.0-py3-none-any.whl Python 3 none any Details for qtass_pyside6-1.0.0-py3-none-any.whl

Total release size: 3.5 MB

Release files / qtass_pyside6-1.0.0.tar.gz

Download URL qtass_pyside6-1.0.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
32638a9614f7e5d379a65fabf7111d7cb0442a8d2d33ea72bf4fff9b14076714
BLAKE2b-256 checksum
How to use checksums
1d55d11da31faa5d694b138dc455d04f5d0613606ccb6e898373deab01596e4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.2 CPython/3.12.16 Linux/7.0.0-1020-azure

Release files / qtass_pyside6-1.0.0-py3-none-any.whl

Download URL qtass_pyside6-1.0.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
79c78ce4f667a7ee0662eff61d4ccc44b4d0f8cc0dfe6a29467f1245220aac69
BLAKE2b-256 checksum
How to use checksums
0b09d3c1b1728d25d55e77ee13d32dce50599b5223e677e06d33a351aeed143b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.2 CPython/3.12.16 Linux/7.0.0-1020-azure

Security for qtass-pyside6 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page