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
  • Binding neutral — works with PySide6 or PyQt6
  • Custom fonts — drop font files in the package 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 qtshadcn._qt import QtWidgets
from qtshadcn import apply_theme

app = QtWidgets.QApplication(sys.argv)

tokens = apply_theme(
    app,
    theme_file="path/to/my_theme.xml",
    theme_mode="auto",  # "auto" | "light" | "dark"
)
print(tokens.primary)  # resolved hex color

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

Widget Gallery

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 — 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
  • 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>system-ui, sans-serif</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

apply_theme(app, theme_file, *, theme_mode, custom_tokens, additional_qss, default_theme) -> ShadcnThemeTokens

Parses the XML theme, renders the QSS stylesheet, and calls app.setStyleSheet().

Parameter Type Default Description
app QApplication | None None The running Qt application instance
theme_file str | None None Path to the .xml theme file; None loads the default
theme_mode str "auto" "auto", "light", or "dark"
custom_tokens dict[str, dict[str, str] | str] | None None Token overrides (mode-specific when keys are "light"/"dark")
additional_qss str | None None Inline Jinja snippet, .qss file path, or .jinja file path to append
default_theme str "dark" Fallback mode when theme_mode="auto" and OS detection fails

Returns the active ShadcnThemeTokens (light or dark, resolved).

get_theme() -> ShadcnTheme | None

Returns the full resolved theme (both palettes) from disk cache, or None if no theme has been applied yet.

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


Contributing

Contributions are welcome. See CONTRIBUTING.md for setup instructions, coding conventions, and architecture rules.


License

MIT

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

Built distribution (wheel)

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

Total release size: 5.6 MB

Release files / qtshadcn-0.1.0.tar.gz

Download URL qtshadcn-0.1.0.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
96cf28ea7488160d7e5f34f9dbc07f1e8da28c714b7843f8eb841b8d70808e2e
BLAKE2b-256 checksum
How to use checksums
8c53b2805ab820d27a6e4d795534d256173909db15bfbe3987fc0a308c2bcb0e
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 Aug 11, 2026.

Transparency log

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

Download URL qtshadcn-0.1.0-py3-none-any.whl
Size 2.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
efbfca27308fdfa0c7d1826da77c399c3a1c121eb609f5a69c8b11f65aa6e7a8
BLAKE2b-256 checksum
How to use checksums
291e4a59cc19aae5009011f1d7458d8ea45ecd48a31489a927241716fb52c3af
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 Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

0.0.22

2 release files

0.0.9

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

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