You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/create-and-add-icons.md
+57-8Lines changed: 57 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ description: >-
8
8
9
9
## Generating an icon
10
10
11
-
Generating your icon can be done using various conversion tools found online. It is recommended to start with a 1024x1024px image before converting it to various sizes.
11
+
Generating your icon can be done using various conversion tools found online. It is recommended to start with a 1024x1024px image before converting it to the formats required by each platform.
12
12
13
13
### Supporting higher pixel densities
14
14
@@ -33,19 +33,23 @@ The following suffixes for DPI are also supported:
33
33
34
34
The recommended file formats and icon sizes for each platform are as follows:
| macOS |`.icns`(or `.icon`) | Use a 1024x1024 source image. Keep an `.icns` file for compatibility, and add an Icon Composer `.icon` file for macOS 26+.|
39
+
| Windows |`.ico`| 256x256 pixels|
40
+
| Linux |`.png`| 512x512 pixels|
41
41
42
42
{% hint style="warning" %}
43
43
On Windows, ensure that your `.ico` file is exported from an image editor that supports the format (such as [GIMP](https://www.gimp.org/)). Renaming a `.png` file into `.ico` will result in a `Fatal error: Unable to set icon` error.
44
44
{% endhint %}
45
45
46
+
{% hint style="info" %}
47
+
`@electron/packager` supports macOS Icon Composer files as of [`@electron/packager` v18.4.0](https://github.com/electron/packager/releases/tag/v18.4.0). To support both macOS 26+ and earlier releases, provide both an `.icns` file and a `.icon` file.
48
+
{% endhint %}
49
+
46
50
## Setting the app icon
47
51
48
-
### Windows and macOS
52
+
### Windows
49
53
50
54
Configuring the path to your icon can be done in your Forge configuration.
51
55
@@ -62,7 +66,52 @@ module.exports = {
62
66
{% endcode %}
63
67
64
68
{% hint style="success" %}
65
-
Forge will automatically add the correct extension for each platform, so appending `.ico` or `.icns` to the path is not required.
69
+
When you provide a single icon path, Electron Packager will automatically add the correct platform extension, so appending `.ico` here is not required.
70
+
{% endhint %}
71
+
72
+
After the config has been updated, build your project to generate your executable with the Make command.
73
+
74
+
### macOS
75
+
76
+
If you only need the traditional macOS icon format, you can continue to provide a single `icon` path in `packagerConfig`:
77
+
78
+
{% code title="forge.config.js" %}
79
+
```javascript
80
+
module.exports= {
81
+
// ...
82
+
packagerConfig: {
83
+
icon:'/path/to/icon'// .icns will be inferred
84
+
}
85
+
// ...
86
+
};
87
+
```
88
+
{% endcode %}
89
+
90
+
If you need one configuration that supports both macOS 26+ and earlier macOS releases, provide both an `.icns` file and an `.icon` file:
91
+
92
+
{% code title="forge.config.js" %}
93
+
```javascript
94
+
module.exports= {
95
+
// ...
96
+
packagerConfig: {
97
+
icon: [
98
+
'/path/to/icon.icns',
99
+
'/path/to/icon.icon'
100
+
]
101
+
}
102
+
// ...
103
+
};
104
+
```
105
+
{% endcode %}
106
+
107
+
Electron Packager will use the `.icns` file on macOS versions earlier than 26, and the `.icon` file on macOS 26 and later.
108
+
109
+
{% hint style="warning" %}
110
+
Packaging an `.icon` file currently requires macOS 26 or later and Xcode 26 or later because Electron Packager uses Apple's `actool` tool to compile the Icon Composer asset.
111
+
{% endhint %}
112
+
113
+
{% hint style="info" %}
114
+
When you provide multiple macOS icon files, include the file extensions explicitly so Packager can distinguish the `.icns` and `.icon` inputs.
66
115
{% endhint %}
67
116
68
117
After the config has been updated, build your project to generate your executable with the Make command.
0 commit comments