Skip to main content

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 cairosvg fails to install, run brew install cairo first. 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, read HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme
  • Electron: use nativeTheme.shouldUseDarkColors and call tray.setImage() on updates

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svg_icon_gen-0.2.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

svg_icon_gen-0.2.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

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

Hashes for svg_icon_gen-0.2.1.tar.gz
Algorithm Hash digest
SHA256 65033555218bb4a2eca6e51c85e70e48f269801761aa4a9ce3a0d212e4c781db
MD5 ad96ea11a2af0c9e42cb8e5a90bc781a
BLAKE2b-256 4f118a815ab60f9d72ee4f757f0fb82a0a6f77afa9003f234a9d5c212f0fde0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for svg_icon_gen-0.2.1.tar.gz:

Publisher: publish.yml on Kookiejarz/svg-icon-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for svg_icon_gen-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e4224d05ba0e6e591a40bafdc8f481cb2f79d7170c15d9bf03c74b79f0a7f2c
MD5 bb03401ce2a4f2acd48d1eeafb6711c9
BLAKE2b-256 88d4c20e7e3f2fc788fe60f1fd978f9830e59102382300e7e49bba15c00d471f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page