electron 配置mac安装的图标
使用的 icon.icns
准备一张 1024 * 1024 的png图片
1. 在项目根目录中创建文件()
mkdir tmp.iconset2. 生成多个比例不同的图片
sips -z 16 16 logo.png --out tmp.iconset/icon_16x16.png sips -z 32 32 logo.png --out tmp.iconset/[email protected] sips -z 32 32 logo.png --out tmp.iconset/icon_32x32.png sips -z 64 64 logo.png --out tmp.iconset/[email protected] sips -z 128 128 logo.png --out tmp.iconset/icon_128x128.png sips -z 256 256 logo.png --out tmp.iconset/[email protected] sips -z 256 256 logo.png --out tmp.iconset/icon_256x256.png sips -z 512 512 logo.png --out tmp.iconset/[email protected] sips -z 512 512 logo.png --out tmp.iconset/icon_512x512.png sips -z 1024 1024 logo.png --out tmp.iconset/[email protected]
3. 生成 icns
iconutil -c icns tmp.iconset -o icon.icns
4. 修改配置文件
package.json
{ .... "build": { "asar": true, "files": [ "./dist/**/*", "dist/**/*", "electron/**/*" ], "appId": "com.XXXX.XXX", "productName": "XXXXX", "copyright": "Copyright © 2022 XXXXX", "icon": "./Icon.icns", "win": { "icon": "./Icon.icns", "artifactName": "digital_shield.${ext}", "verifyUpdateCodeSignature": false, "requestedExecutionLevel": "highestAvailable", "target": [ "nsis", "zip" ] }, "mac": { "icon": "./Icon.icns", "category": "public.app-category.utilities" }, "nsis": { "oneClick": false, "allowToChangeInstallationDirectory": false, "installerIcon": "./Icon.icns", "uninstallerIcon": "./Icon.icns", "installerHeader": "./Icon.icns", "installerHeaderIcon": "./Icon.icns", "createDesktopShortcut": true, "createStartMenuShortcut": true, "shortcutName": "XXXXXXXXX" } }, .... }
标签:tmp,icns,--,electron,mac,iconset,png,icon From: https://www.cnblogs.com/Ferdinand-B/p/17359392.html