Skip to main content

QtShadcn logo

QtShadcn

PyPI version PyPI downloads License Python versions Platform

Modern styling and theming framework for Qt/PySide and PyQt applications, inspired by shadcn/ui.

QtShadcn loads a local XML theme file containing <light> and <dark> palettes, resolves the design tokens, renders a QSS stylesheet via Jinja2, and applies it to your QApplication in one call.


Features

  • Light & dark palettes — single XML file, both modes
  • Auto mode — follows the OS theme via darkdetect
  • Flexible scope — apply styles app-wide to QApplication or scope to a specific QWidget
  • Binding neutral — works with PySide6 or PyQt6 via a native internal shim
  • Custom fonts — drop font files in the package resources/fonts/ directory
  • Disk cache — theme is re-rendered only when the source file changes
  • App-provided Qt runtime — install the Qt binding your app already uses
  • Themed icons — SVG check icons generated and cached at runtime

Requirements

  • Python >= 3.11
  • One of: PySide6 or PyQt6 (provided by your application environment)

Installation

# Install QtShadcn from PyPI
pip install qtshadcn

# Or with uv
uv add qtshadcn

QtShadcn does not bundle a Qt binding. Install the binding your application already uses:

# PySide6 (recommended)
pip install PySide6

# Or PyQt6
pip install PyQt6

Quick Start

import sys
from PySide6 import QtWidgets
from qtshadcn import setTheme, setThemeMode, getTheme

app = QtWidgets.QApplication(sys.argv)

setThemeMode("auto", save=False)  # "auto" | "light" | "dark"
setTheme("path/to/my_theme.xml", save=False)
tokens = getTheme()
print(tokens.primary)  # resolved hex color

label = QtWidgets.QLabel("Hello, QtShadcn!")
label.show()
sys.exit(app.exec())

Explore the supported widgets by running the gallery:

make gallery

The gallery includes a sidebar navigator, a light/dark toggle, and pages for every currently styled widget.


Supported Styled Widgets

QtShadcn currently ships QSS for:

  • QWidget — base background, foreground, and typography classes
  • QLabel — typography and disabled state
  • QPushButton — variants, sizes, and disabled states
  • QToolButton — compact icon/action variants
  • QCheckBox — toggle controls with themed check icons and disabled states
  • QRadioButton — radio controls with themed checked icons
  • QLineEdit — input states including focus, disabled, and invalid
  • QTextEdit and QPlainTextEdit — textarea states including focus, disabled, and invalid
  • QComboBox and QFontComboBox — dropdowns, popups, and invalid states
  • QProgressBar — determinate, thin, and disabled states
  • QSlider — horizontal, vertical, tick, and disabled states
  • QScrollArea and QScrollBar — scroll containers with pill-shaped, minimal tracks
  • QToolBox — accordion with collapsible sections, dynamic chevrons, and outline/card variants
  • QTableView and QTableWidget — data tables with header styling, horizontal dividers, cell hover/selection, in-cell editors, and checkable indicators
  • QGroupBox and QFrame — layout containers

See the roadmap for what is planned next.


Theme File Format

A QtShadcn theme is a plain XML file with two palette sections:

<theme>
  <light>
    <background>#ffffff</background>
    <foreground>#020617</foreground>
    <primary>#0f172a</primary>
    <primary_foreground>#f8fafc</primary_foreground>
    <secondary>#f1f5f9</secondary>
    <secondary_foreground>#0f172a</secondary_foreground>
    <accent>#f1f5f9</accent>
    <accent_foreground>#0f172a</accent_foreground>
    <muted>#f1f5f9</muted>
    <muted_foreground>#64748b</muted_foreground>
    <destructive>#ef4444</destructive>
    <destructive_foreground>#f8fafc</destructive_foreground>
    <border>#e2e8f0</border>
    <input>#e2e8f0</input>
    <ring>#0f172a</ring>
    <radius>8px</radius>
    <font_family>Open Sans</font_family>
    <spacing>4px</spacing>
    <card>#ffffff</card>
    <card_foreground>#020617</card_foreground>
    <popover>#ffffff</popover>
    <popover_foreground>#020617</popover_foreground>
  </light>
  <dark>
    <!-- same tokens, dark values -->
  </dark>
</theme>

Unknown tokens are silently ignored so you can extend the format freely.


API Reference

QtShadcn exposes a small, composable public API directly from the package root:

from qtshadcn import (
    qsettings,
    ThemeMode,
    setThemeMode,
    toggleThemeMode,
    themeMode,
    isDarkTheme,
    setTheme,
    getTheme,
    setStyleSheet,
    getStyleSheet,
    SystemThemeWatcher,
)

setThemeMode(mode, *, target=None, save=True)

Set the active theme mode ("auto", "light", or "dark") and re-render the stylesheet. Pass target (QWidget) to scope the stylesheet to that window subtree instead of the entire QApplication.

toggleThemeMode(*, target=None, save=True)

Cycle the theme mode: auto → light → dark → auto. Pass target (QWidget) to scope to a specific window subtree.

themeMode() -> ThemeMode

Return the current ThemeMode.

isDarkTheme() -> bool

Return whether the resolved active palette is dark.

setTheme(source, *, custom_tokens=None, target=None, save=True)

Load a QtShadcn .xml or .json theme, apply optional token overrides, and re-render the stylesheet. Pass target (QWidget) to scope the stylesheet to that window subtree.

getTheme() -> ShadcnThemeTokens

Return the resolved tokens for the active mode.

setStyleSheet(source, *, target=None, save=True)

Set an additional stylesheet (inline QSS/Jinja string or .qss/.jinja file path) layered on top of the base QSS. Pass target (QWidget) to scope the stylesheet to that window subtree.

getStyleSheet() -> str

Return the current additional stylesheet content.

ShadcnThemeTokens

Immutable Pydantic model with one field per design token (background, primary, border, radius, font_family, ...). Every token is required in both XML palettes; missing tokens raise ThemeParseError.


Documentation


License

MIT

Metadata

Release files for qtshadcn 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 qtshadcn 1.0.0
File Size Uploaded
qtshadcn-1.0.0.tar.gz 3.4 MB Details

Built distribution (wheel)

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

Total release size: 6.2 MB

Release files / qtshadcn-1.0.0.tar.gz

Download URL qtshadcn-1.0.0.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
7a4d8ec36a1aef95b5e600204d1b3d2596f057179e0b3373321ffbe77b9e6ba2
BLAKE2b-256 checksum
How to use checksums
4283b4168c8dd9ef6e8f4ca78aa52f98a0bd63045a521a09eb0e8efb06753327
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

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

Download URL qtshadcn-1.0.0-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7a2fbb09d03f11d3748d240c1ee268a720bf5e9051a40a6d43c7d61a8e5e4ebf
BLAKE2b-256 checksum
How to use checksums
98e3ad1d7ed55752fecc3924b66920a38d3cd8bc7227e995559aede4dec08ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log
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