本文介绍了如何为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.

我是否需要打包应用才能看到效果?

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

推荐答案

创建 BrowserWindow时设置图标属性仅对Windows和Linux有影响。

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

要在OS X上设置图标,可以使用并使用 - 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设置应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 10:31