@thefurdui/wic
v1.1.0
Published
A CLI tool that generates wide-gamut (Display P3) web assets and safely converts them to legacy sRGB favicons from a single SVG source.
Readme
wic (Wide-gamut Icon Compiler)
A CLI tool that generates modern wide-gamut (Display P3) web assets and legacy sRGB favicons from a single SVG source.
Why?
Most standard image processors (like ImageMagick or librsvg) rely on underlying C libraries that don't understand modern CSS color spaces like oklch() or display-p3. If your master SVG uses wide-gamut colors, traditional asset pipelines will clip, mute, or fail to render your icons.
wic solves this by running a headless Chromium browser to parse your CSS exactly as a real browser would:
- It renders Apple Touch and PWA icons using a
display-p3color profile to preserve maximum color accuracy. - It safely converts your colors down to an
srgbprofile for legacy.icofallbacks. - It can inject a pure-vector circular mask for desktop Chrome tabs without altering your original coordinate space.
Usage
npx @thefurdui/wic -s <source.svg> -n "<App Name>" -o <output_dir> [-r <radius_percentage>](Alternatively, use pnpm dlx @thefurdui/wic or bunx @thefurdui/wic)
Options:
-s, --source: Path to your master SVG. Must be a sharp-cornered square.-n, --name: The application name (this is injected or updated in yourmanifest.json).-o, --output: Target directory for the generated assets (e.g.,publicordist).-r, --radius: (Optional) Border radius percentage applied natively to Android/PWA icons andfavicon.svg(e.g.,15). Note: Theapple-touch-icon.pngignores this and stays sharp per Apple's guidelines.
Example:
npx @thefurdui/wic -s assets/master-logo.svg -n "Lode Beat" -o public -r 15Note for
pnpmusers: If you are usingpnpm, make sure to allow thepuppeteerpostinstall script to ensure your headless Chromium instance downloads properly.Note for Linux users: If you are running this on a barebones Linux server (like a CI/CD pipeline) or WSL, Puppeteer may require standard Chromium system shared libraries (like
libnss3orlibgbm1) to be installed via your package manager to prevent crash errors.
Generated Output
Running the command will generate the following assets in your target directory:
favicon.svg(Display P3, masked if radius is provided)apple-touch-icon.png(180x180, Display P3, sharp corners)icon-192.png(192x192, Display P3, rounded if radius provided)icon-512.png(512x512, Display P3, rounded if radius provided)favicon.ico(Multi-layer 64/48/32/16, sRGB gamut-mapped)manifest.json(Bootstrapped or dynamically updated)
License
MIT
