QtShadcn
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, PyQt6, PySide2, or PyQt5
- 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, PyQt6, PySide2, or PyQt5 (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, PySide2, PyQt5
pip install PyQt6
Quick Start
import sys
from qtshadcn._qt import QtWidgets
from qtshadcn import ThemeConfig, apply_theme
app = QtWidgets.QApplication(sys.argv)
config = ThemeConfig(
theme_source_path="path/to/my_theme.xml",
theme_mode="auto", # "auto" | "light" | "dark"
)
tokens = apply_theme(app, config)
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 classesQLabel— typography and disabled stateQPushButton— variants, sizes, and disabled statesQToolButton— compact icon/action variantsQCheckBox— toggle controls with themed check icons and disabled statesQRadioButton— radio controls with themed checked iconsQLineEdit— input states including focus, disabled, and invalidQTextEdit— textarea states including focus, disabled, and invalidQComboBoxandQFontComboBox— dropdowns, popups, and invalid statesQProgressBar— determinate, thin, and disabled statesQSlider— horizontal, vertical, tick, and disabled statesQGroupBoxandQFrame— 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, config) -> ShadcnThemeTokens
Parses the XML theme, renders the QSS stylesheet, and calls app.setStyleSheet().
| Parameter | Type | Description |
|---|---|---|
app |
QApplication |
The running Qt application instance |
config |
`ThemeConfig | None` |
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.
ThemeConfig
| Field | Type | Default | Description |
|---|---|---|---|
theme_source_path |
`str | None` | None |
theme_mode |
`"auto" | "light" | "dark"` |
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
- Docs site: https://qtshadcn.readthedocs.io/
- Widget gallery:
examples/gallery/main.py(runmake gallery)
Contributing
Contributions are welcome. See CONTRIBUTING.md for setup instructions, coding conventions, and architecture rules.
License
MIT
Release files for qtshadcn 0.0.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qtshadcn-0.0.21.tar.gz | 2.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qtshadcn-0.0.21-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 MB
Release files / qtshadcn-0.0.21.tar.gz
| Download URL | qtshadcn-0.0.21.tar.gz |
|---|---|
| Size | 2.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1a615d824ec1c5764a115738c367bc1528d8dec0d726119ca4bbf594d99d94e
|
|
BLAKE2b-256 checksum How to use checksums |
17f21d9d38d39c208ae1f61ee42528af835f40a8e5936096dbacb54662fd9543
|
| 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 7, 2026.
Transparency logRelease files / qtshadcn-0.0.21-py3-none-any.whl
| Download URL | qtshadcn-0.0.21-py3-none-any.whl |
|---|---|
| Size | 2.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
faea3d5b5b5334e34e371835b151aa1138f24c2826a96d6b48bc972757a7a5c0
|
|
BLAKE2b-256 checksum How to use checksums |
cdc582ae877c35a30dc06816e16d593fd26b634ef6d5614c52159ab24d04c94a
|
| 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 7, 2026.
Transparency log