pyqt6-icon-theme
PyQt6 Dynamic Icon Theme Toolkit — Support automatic light/dark theme switching for SVG icons, with customizable color effects.
Features
- SVG Dynamic Recoloring — Automatically strips original fill/stroke and applies any custom color
- Theme Awareness — Automatically switches between black (light theme) and white (dark theme) when no custom color is set
- Hover Effect — Switches icon color on mouse enter/leave
- PNG / JPG Support — Renders raster images at any size while preserving original colors
- Caching — Icons are cached by
(name, color, size, keep_original)to avoid redundant rendering
Installation
pip install pyqt6-icon-theme
Usage
Import the library:
from pyqt6_icon_theme import IconManager, IconButton
Set the icon directory (supports .svg, .png, .jpg, .jpeg); the path name is customizable:
IconManager.set_icon_dir("icons")
IconButton
- 1st parameter: icon file name — extension is optional
- 2nd parameter: icon size in pixels
- 3rd parameter: icon color in normal state — if
None, the color is automatically detected from the window background (black on light, white on dark) - 4th parameter: icon color on hover — if
None, no color change on hover - 5th parameter: preserve the SVG's original colors — if
True,normal_colorandhover_colorare ignored; defaults toFalse
IconButton(name, size=16, normal_color=None, hover_color=None, keep_original=False)
Examples
# Auto color based on theme (light = black, dark = white)
btn = IconButton("user.svg", size=30)
# Custom color + hover effect
btn = IconButton("add.svg", size=36,
normal_color="#49ADF0",
hover_color="#F08884")
# Preserve SVG original colors (unaffected by theme)
btn = IconButton("edit.svg", size=40, keep_original=True)
# PNG/JPG — always displays original colors
btn = IconButton("delete.png", size=40)
Parameter Behavior Reference
| Scenario | normal_color |
hover_color |
keep_original |
Result |
|---|---|---|---|---|
| SVG, no color specified | None |
None |
False |
Follows theme (black/white) |
| SVG, custom color | "#49ADF0" |
"#F08884" |
False |
Custom color + hover |
| SVG, original colors | — | — | True |
SVG rendered as-is |
| PNG / JPG | ignored | ignored | ignored | Always original colors |
Icon Directory Structure
your_project/
├── icons/
│ ├── user.svg
│ ├── add.svg
│ ├── edit.svg
│ └── delete.png
└── main.py
All .svg, .png, .jpg, .jpeg files in the directory are loaded automatically.
Demo
See the Repository for details.
Metadata
Release files for pyqt6-icon-theme 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyqt6_icon_theme-0.1.5.tar.gz | 6.3 kB | Without provenance | Details for pyqt6_icon_theme-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyqt6_icon_theme-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for pyqt6_icon_theme-0.1.5-py3-none-any.whl |
Total release size: 13.4 kB
Release files / pyqt6_icon_theme-0.1.5.tar.gz
| Download URL | pyqt6_icon_theme-0.1.5.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0e374ca067fb703204fd3db1c01aa64429b91d533d220f3a80280a3de9656a2
|
|
BLAKE2b-256 checksum How to use checksums |
dd0b14ffb7939305cd300eac995a7ed358a732bd9eb5f7e7ae91fbe186fe86e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.13.3 Windows/11
|
Release files / pyqt6_icon_theme-0.1.5-py3-none-any.whl
| Download URL | pyqt6_icon_theme-0.1.5-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d26d7ce53614720762a1668ac14b778a99d115c8a24fdb99384980aa06a8ff7
|
|
BLAKE2b-256 checksum How to use checksums |
e810c728048a8b794027431ffaa03808044cd1bdd495e0ae39699566f7bbfd6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.13.3 Windows/11
|
Security for pyqt6-icon-theme 0.1.5
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.