如何为 Electron/Atom Shell App 设置应用程序图标 [英] How to set app icon for Electron / Atom Shell App

查看:22
本文介绍了如何为 Electron/Atom Shell App 设置应用程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 Electron 应用设置应用图标?

How do you set the app icon for your Electron app?

我正在尝试 BrowserWindow({icon:'path/to/image.png'}); 但它不起作用.

I am trying BrowserWindow({icon:'path/to/image.png'}); but it does not work.

是否需要打包app才能看到效果?

Do I need to pack the app to see the effect?

推荐答案

在创建 BrowserWindow 时设置 icon 属性只对 Windows 和 Linux 有效.

Setting the icon property when creating the BrowserWindow only has an effect on Windows and Linux.

要在 OS X 上设置图标,您可以使用 electron-packager 并设置图标使用 --icon 开关.

To set the icon on OS X, you can use electron-packager and set the icon using the --icon switch.

对于 OS X,它需要采用 .icns 格式.有一个在线图标转换器 它可以从你的 .png 创建这个文件.

It will need to be in .icns format for OS X. There is an online icon converter which can create this file from your .png.

这篇关于如何为 Electron/Atom Shell App 设置应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆