Icons
showcase icons turns one square image into the icon set a web app, an Electron app or a Tauri app
expects. It needs no config file: it does not look for showcase.config.* at all, so you can run it
in any folder.
npx showcase icons --source assets/mascot.png --preset electron --out apps/desktop/resources| Option | Meaning |
|---|---|
--source <file> |
The source image. Required. |
--preset <name> |
web, electron or tauri. Required. |
--out <dir> |
Where to write the files. Default icons. The folder is created if it is missing. |
--source and --out are relative to the directory you run the command in. Existing files with
the same names are overwritten. The full option list is in the
CLI reference.
The source image
Section titled “The source image”Use a square PNG, 1024x1024 or larger, ideally on a transparent background. Every size is scaled
down with contain onto a transparent square, so nothing is cropped, and every PNG (standalone or
inside an .ico or .icns) is full-color RGBA.
The kit accepts other images but tells you when it has to compromise:
- A source that is not square prints a warning and is padded with transparency to a square, per size.
- A source smaller than 1024 px prints a warning: every size above the source’s is upscaled and looks soft.
- A missing
--sourceor--presetfails, a source that does not exist fails withIcon source not found, and an unknown preset fails with the list of presets.
Presets
Section titled “Presets”Each preset writes exactly these files, and nothing else:
| Preset | File | Contents |
|---|---|---|
web | favicon.ico | ICO with 16, 32, 48 px images |
| web | apple-touch-icon.png | PNG, 180x180 |
| web | icon-192.png | PNG, 192x192 |
| web | icon-512.png | PNG, 512x512 |
electron | icon.png | PNG, 1024x1024 |
| electron | icon-16.png | PNG, 16x16 |
| electron | icon-32.png | PNG, 32x32 |
| electron | icon.ico | ICO with 16, 32, 48, 256 px images |
tauri | 32x32.png | PNG, 32x32 |
| tauri | 128x128.png | PNG, 128x128 |
| tauri | 128x128@2x.png | PNG, 256x256 |
| tauri | icon.png | PNG, 1024x1024 |
| tauri | icon.ico | ICO with 16, 24, 32, 48, 64, 256 px images |
| tauri | icon.icns | ICNS, 16 to 512@2x |
The .ico files hold PNG images (the format Windows Vista and later read). The .icns file holds
PNG images too, with the same icon types Apple’s iconutil writes.
From code
Section titled “From code”generateIcons(source, preset, outDir) does the same as the command and resolves with the files it
wrote, in preset order:
import { generateIcons } from '@noctcore/showcase-kit';
const written = await generateIcons('assets/mascot.png', 'web', 'public');// [{ file: 'favicon.ico', path: 'public/favicon.ico' }, ...]ICON_PRESETS is exported too, if a build script needs the file list. See the
programmatic API.