Skip to content

Commit b91c313

Browse files
committedApr 20, 2023
Improve Platform__Icons.md
1 parent 7131c22 commit b91c313

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed
 

‎topics/Platform__Icons.md

+40-20
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,26 @@
22

33
Icons make it easy to find and explore features in ReSharper and Rider. They can appear in buttons that execute actions, in navigation to differentiate between members, in the gutter to highlight source code, or as various indicators to visualize results (unit testing, solution-wide analysis).
44

5-
Typically, icons come in different colors and tones to match the user-selected theme (light, dark). You can change the theme:
6-
7-
- In ReSharper under `Options | Environment | General | User Interface | Application icons theme`
8-
- In Rider under `Preferences | Appearance & Behavior | Appearance | Theme`
9-
- In Visual Studio under `Options | Environment | General | Color Theme`
5+
Typically, icons come in different colors and tones to match the user-selected theme (light, dark, etc.). You can change the theme:
6+
7+
<table>
8+
<tr>
9+
<td>Product</td>
10+
<td>Menu Path</td>
11+
</tr>
12+
<tr>
13+
<td>ReSharper</td>
14+
<td><menupath>Options | Environment | General | User Interface | Application icons theme</menupath></td>
15+
</tr>
16+
<tr>
17+
<td>Rider</td>
18+
<td><menupath>Preferences | Appearance &amp; Behavior | Appearance | Theme</menupath></td>
19+
</tr>
20+
<tr>
21+
<td>Visual Studio</td>
22+
<td><menupath>Options | Environment | General | Color Theme</menupath></td>
23+
</tr>
24+
</table>
1025

1126
[//]: # (## Plugin Icon)
1227
[//]: # ()
@@ -16,7 +31,7 @@ Typically, icons come in different colors and tones to match the user-selected t
1631

1732
The SDK comes with an extensive set of icons that are probably already familiar to you.
1833

19-
You can browse the library in ReSharper's internal mode (`devenv.exe /ReSharper.Internal`) by navigating to `ReSharper | Internal | Windows | Themed Icon Viewer`:
34+
You can browse the library in ReSharper's internal mode (`devenv.exe /ReSharper.Internal`) by navigating to <menupath>ReSharper | Internal | Windows | Themed Icon Viewer</menupath>:
2035

2136
![Themed Icon Viewer](Platform__Icons__Themed_Icon_Viewer.png)
2237

@@ -26,8 +41,8 @@ You can browse the library in ReSharper's internal mode (`devenv.exe /ReSharper.
2641

2742
On the right-hand side, you can see the name of the icon as well as the icon pack it belongs to (here `AddMissing` and `CommonThemedIcons`). Those names should be enough to reference them in your code through [code-completion](https://www.jetbrains.com/help/rider/Auto-Completing_Code.html). Each icon is contained in its own class under the `*ThemedIcons` icon pack class. Depending on the way the SDK is asking for an icon, you can pass them as:
2843

29-
- `typeof(ThemedIcons.Icon)` or
30-
- `ThemedIcons.Icon.Id`
44+
- `typeof(MyPluginThemedIcons.Icon)` or
45+
- `MyPluginThemedIcons.Icon.Id`
3146

3247
## Custom Compiled Icons
3348

@@ -37,7 +52,7 @@ Similar to the icons that come out-of-the-box, you can add your own icons as _co
3752

3853
SVG is a very rich format, but ReSharper can only create compiled icons from so-called _optimized SVGs_. Once you have your SVG, you can optimize it using the [latest version of Inkscape](https://inkscape.org/release/).
3954

40-
Open the SVG, select `File | Save As...`, choose _Optimized SVG_, and enable the following options after hitting _Save_:
55+
Open the SVG, select <menupath>File | Save As...</menupath>, choose <control>Optimized SVG</control>, and enable the following options after hitting <control>Save</control>:
4156

4257
- Options
4358
- Shorten color values
@@ -69,37 +84,42 @@ If your icons should adapt to different themes, you must provide multiple files
6984
Once your SVG icons are prepared and located in a common directory:
7085

7186
1. Open the _Themed Icon Viewer_
72-
2. Choose `Add Pane | Directory with Icon Files`
87+
2. Choose <control>Add Pane | Directory with Icon Files</control>
7388
3. Select all icons you want to export
74-
4. Choose `Export | Export C# Code – SVG Body`
89+
4. Choose <control>Export | Export C# Code – SVG Body</control>
90+
91+
A file with the compiled icons should open. You can rename any of the icon classes, the icon pack class, or move them to another namespace.
7592

76-
A file with the compiled icons should open. Feel free to rename any of the icon, the icon pack, or move them to another namespace.
93+
> When targeting Rider, you should keep in mind that the pack name is defined through the parent class name of your icon classes with `ThemedIcons` trimmed from the end. If the resulting string is empty, the pack name is `Unnamed`. If you choose to keep your icon classes un-nested, the pack name is `Ungrouped`.
94+
>
95+
{type="warning"}
7796

7897
## Rider Icons
7998

80-
Icons that only surface in Rider (e.g., for run configurations or tool windows) are handled through the IntelliJ SDK. The equivalent of exporting compiled icons is to create a `ThemedIcons.kt` as follows:
99+
Icons that only surface in Rider (e.g., for run configurations or tool windows) are handled through the IntelliJ SDK. The equivalent of exporting compiled icons is to create a `MyPluginThemedIcons.kt` as follows:
81100

82101
```kotlin
83102
package icons
84103

85104
import com.intellij.openapi.util.IconLoader
86105

87106
// Feel free to rename
88-
object ThemedIcons {
89-
@JvmField val Icon = IconLoader.getIcon("/path-to/icon.svg", javaClass)
107+
object MyPluginThemedIcons {
108+
@JvmField val Icon = IconLoader.getIcon("/resharper/MyPlugin/Icon.svg", javaClass)
90109
}
91110
```
92111

93-
The `ThemedIcons.kt` and your SVG icons should be located as follows:
112+
The `MyPluginThemedIcons.kt` and your SVG icons should be located as follows:
94113

95114
```text
96115
src/rider/main
97116
├── kotlin/icons
98-
│ └── ThemedIcons.kt
117+
│ └── MyPluginThemedIcons.kt
99118
└── resources
100-
└── path-to (custom or omit)
101-
├── icon.svg
102-
└── icon_Dark.svg
119+
└── resharper
120+
└── MyPlugin # pack name with 'ThemedIcons' trimmed
121+
├── <Icon>.svg
122+
└── <Icon_Dark.svg
103123
```
104124

105125
> Please refer to the [IntelliJ Platform SDK](https://plugins.jetbrains.com/docs/intellij/work-with-icons-and-images.html) for more information.

0 commit comments

Comments
 (0)
Failed to load comments.