Skip to content

Commit f1ee35e

Browse files
authored
doc: document occasional mismatch between NSImageName and string (electron#17826)
1 parent 829050d commit f1ee35e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/api/native-image.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ The `hslShift` is applied to the image with the following rules
198198
This means that `[-1, 0, 1]` will make the image completely white and
199199
`[-1, 1, 0]` will make the image completely black.
200200

201+
In some cases, the `NSImageName` doesn't match its string representation; one example of this is `NSFolderImageName`, whose string representation would actually be `NSFolder`. Therefore, you'll need to determine the correct string representation for your image before passing it in. This can be done with the following:
202+
203+
`echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' | clang -otest -x objective-c -framework Cocoa - && ./test`
204+
205+
where `SYSTEM_IMAGE_NAME` should be replaced with any value from [this list](https://developer.apple.com/documentation/appkit/nsimagename?language=objc).
206+
201207
## Class: NativeImage
202208

203209
> Natively wrap images such as tray, dock, and application icons.

0 commit comments

Comments
 (0)