Skip to content

Commit f0fc08a

Browse files
committed
Add Platform__Icons.md
1 parent 3e56562 commit f0fc08a

File tree

4 files changed

+110
-1
lines changed

4 files changed

+110
-1
lines changed
452 KB
Loading

rsd.tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
<toc-element toc-title="Transactions"/>
163163
<toc-element toc-title="IL Metadata"/>
164164
<toc-element toc-title="Shell"/>
165+
<toc-element id="Platform__Icons.md"/>
165166
<toc-element id="Settings.md"
166167
toc-title="Settings"
167168
accepts-web-file-names="Platform/Settings.html">

topics/Intro/content_updates.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ See [GitHub Changelog](https://github.com/JetBrains/resharper-devguide/commits/m
1010

1111
## 2023
1212

13-
### January 2023
13+
### March 2023
1414

1515
Additions
1616
:
1717
- Add [](Features__Code_Inspections.md) section.
18+
- Add [](Platform__Icons.md) section.
1819

1920
## 2022
2021

topics/Platform__Icons.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
[//]: # (title: Icons)
2+
3+
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).
4+
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`
10+
11+
[//]: # (## Plugin Icon)
12+
[//]: # ()
13+
[//]: # (- `pluginIcon.svg` and `pluginIcon_dark.svg` under `src/rider/main/resources/META-INF`)
14+
15+
## Themed Icons
16+
17+
The SDK comes with an extensive set of icons that are probably already familiar to you.
18+
19+
You can browse the library in ReSharper's internal mode (`devenv.exe /ReSharper.Internal`) by navigating to `ReSharper | Internal | Windows | Themed Icon Viewer`:
20+
21+
![Themed Icon Viewer](Platform__Icons__Themed_Icon_Viewer.png)
22+
23+
> Select _Browse as List_ or _Browse as Icon Packs_ to filter and search icons from the text-box.
24+
>
25+
{type="tip"}
26+
27+
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:
28+
29+
- `typeof(ThemedIcons.Icon)` or
30+
- `ThemedIcons.Icon.Id`
31+
32+
## Custom Compiled Icons
33+
34+
Similar to the icons that come out-of-the-box, you can add your own icons as _compiled icons_. Although compiled icons can also be generated from PNGs, it is highly recommended to use SVGs, as they'll render without any issues on all resolutions.
35+
36+
### Prepare SVG for Conversion
37+
38+
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/).
39+
40+
Open the SVG, select `File | Save As...`, choose _Optimized SVG_, and enable the following options after hitting _Save_:
41+
42+
- Options
43+
- Shorten color values
44+
- Convert CSS attributes to XML attributes
45+
- SVG Output
46+
- Remove the XML declaration
47+
- Remove metadata
48+
- Remove comments
49+
- IDs
50+
- Remove unused IDs
51+
52+
> If you're developing on macOS or Linux, feel free to [reach out to us](getting_help.md#problems-with-code), and we will generate the compiled icons for you.
53+
>
54+
{type="note"}
55+
56+
### Prepare for different Themes
57+
58+
If your icons should adapt to different themes, you must provide multiple files with a theme-selector next to each other:
59+
60+
- `<name>[Color].svg` – corresponds to light themes
61+
- `<name>[GrayDark].svg` – corresponds to dark themes
62+
63+
> If your icon is suitable for both, light and dark themes, you don't need to add theme-selectors.
64+
>
65+
{type="note"}
66+
67+
### Export Compiled Icons
68+
69+
Once your SVG icons are prepared and located in a common directory:
70+
71+
1. Open the _Themed Icon Viewer_
72+
2. Choose `Add Pane | Directory with Icon Files`
73+
3. Select all icons you want to export
74+
4. Choose `Export | Export C# Code – SVG Body`
75+
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.
77+
78+
## Rider Icons
79+
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:
81+
82+
```kotlin
83+
package icons
84+
85+
import com.intellij.openapi.util.IconLoader
86+
87+
// Feel free to rename
88+
object ThemedIcons {
89+
@JvmField val Icon = IconLoader.getIcon("/path-to/icon.svg", javaClass)
90+
}
91+
```
92+
93+
The `ThemedIcons.kt` and your SVG icons should be located as follows:
94+
95+
```text
96+
src/rider/main
97+
├── kotlin/icons
98+
│ └── ThemedIcons.kt
99+
└── resources
100+
└── path-to (custom or omit)
101+
├── icon.svg
102+
└── icon_Dark.svg
103+
```
104+
105+
> Please refer to the [IntelliJ Platform SDK](https://plugins.jetbrains.com/docs/intellij/work-with-icons-and-images.html) for more information.
106+
>
107+
{type="note"}

0 commit comments

Comments
 (0)