Convert SVG files into production-ready icon sets for Windows and macOS
Project description
🏷️ svg-icon-gen
A command-line tool that converts SVG files into production-ready icon sets for Windows and macOS, including automatic dark theme variants.
Output
For each input SVG (e.g. logo.svg), a subfolder named logo/ is created containing:
logo/
├── logo.ico # Windows light theme (multi-resolution: 16–256px)
├── logo_dark.ico # Windows dark theme
├── logo_mac_template.png # macOS menu bar, black (system auto-adapts light/dark)
├── logo_mac_template@2x.png # macOS menu bar, black, Retina
├── logo_mac_template_dark.png # macOS menu bar, white (for Electron / non-native)
├── logo_mac_template_dark@2x.png # macOS menu bar, white, Retina
└── png/
├── light/
│ ├── logo_16x16.png
│ ├── logo_32x32.png
│ └── ...up to 512x512
└── dark/
└── ...same sizes, inverted
Requirements
pip install cairosvg pillow
macOS: if
cairosvgfails to install, runbrew install cairofirst. Windows: install the GTK3 runtime for Cairo support, or use WSL.
Usage
# Single file
python generate_icons.py logo.svg
# Multiple files
python generate_icons.py icon1.svg icon2.svg icon3.svg
# Glob (bash / zsh)
python generate_icons.py assets/*.svg
Options
| Flag | Description |
|---|---|
--ico-only |
Generate ICO files only |
--mac-only |
Generate macOS Template icons only |
--png-only |
Generate PNG files only |
--no-dark |
Skip dark theme variants |
--png-sizes SIZES |
Comma-separated PNG sizes (default: 16,32,64,128,256,512) |
--out-dir DIR |
Root output directory (default: same directory as each SVG) |
--ico-only, --mac-only, and --png-only are mutually exclusive.
Examples
# Only ICO, no dark variant, output to ./dist
python generate_icons.py *.svg --ico-only --no-dark --out-dir ./dist
# Custom PNG sizes
python generate_icons.py logo.svg --png-only --png-sizes 32,64,128
# macOS icons only, all SVGs in a folder
python generate_icons.py assets/*.svg --mac-only
Platform Notes
macOS
Files named *Template.png are automatically rendered by the system to match the current menu bar appearance — no code changes needed for light/dark mode support. The _dark white variants are intended for frameworks that do not support the Template convention:
| Framework | Recommended file |
|---|---|
| SwiftUI / AppKit | *_mac_template.png only |
| Electron | Switch between black and white versions on nativeTheme.on('updated') |
| Tauri | Switch on tauri::api::app::appearance_changed |
Windows
The system tray does not automatically invert icons. Detect the active theme at runtime and swap accordingly:
- Win32: listen for
WM_SETTINGCHANGE, readHKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme - Electron: use
nativeTheme.shouldUseDarkColorsand calltray.setImage()on updates
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file svg_icon_gen-0.2.1.tar.gz.
File metadata
- Download URL: svg_icon_gen-0.2.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65033555218bb4a2eca6e51c85e70e48f269801761aa4a9ce3a0d212e4c781db
|
|
| MD5 |
ad96ea11a2af0c9e42cb8e5a90bc781a
|
|
| BLAKE2b-256 |
4f118a815ab60f9d72ee4f757f0fb82a0a6f77afa9003f234a9d5c212f0fde0c
|
Provenance
The following attestation bundles were made for svg_icon_gen-0.2.1.tar.gz:
Publisher:
publish.yml on Kookiejarz/svg-icon-gen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svg_icon_gen-0.2.1.tar.gz -
Subject digest:
65033555218bb4a2eca6e51c85e70e48f269801761aa4a9ce3a0d212e4c781db - Sigstore transparency entry: 1178559065
- Sigstore integration time:
-
Permalink:
Kookiejarz/svg-icon-gen@a95aad557aaaa7a251608697a0071100ca9523a0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Kookiejarz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a95aad557aaaa7a251608697a0071100ca9523a0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svg_icon_gen-0.2.1-py3-none-any.whl.
File metadata
- Download URL: svg_icon_gen-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e4224d05ba0e6e591a40bafdc8f481cb2f79d7170c15d9bf03c74b79f0a7f2c
|
|
| MD5 |
bb03401ce2a4f2acd48d1eeafb6711c9
|
|
| BLAKE2b-256 |
88d4c20e7e3f2fc788fe60f1fd978f9830e59102382300e7e49bba15c00d471f
|
Provenance
The following attestation bundles were made for svg_icon_gen-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on Kookiejarz/svg-icon-gen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svg_icon_gen-0.2.1-py3-none-any.whl -
Subject digest:
7e4224d05ba0e6e591a40bafdc8f481cb2f79d7170c15d9bf03c74b79f0a7f2c - Sigstore transparency entry: 1178559082
- Sigstore integration time:
-
Permalink:
Kookiejarz/svg-icon-gen@a95aad557aaaa7a251608697a0071100ca9523a0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Kookiejarz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a95aad557aaaa7a251608697a0071100ca9523a0 -
Trigger Event:
push
-
Statement type: