setIconWithAsTemplate

external fun setIconWithAsTemplate(icon: JsImage?, asTemplate: Boolean): Promise<Void>(source)

Sets a new tray icon and template status atomically. macOS only.

Note that you may need the image-ico or image-png Cargo features to use this API. To enable it, change your Cargo.toml file:

[dependencies]
tauri = { version = "...", features = ["...", "image-png"] }

Prefer this over calling {@linkcode TrayIcon.setIcon} and {@linkcode TrayIcon.setIconAsTemplate} in sequence, which can briefly show the new icon with the previous template setting.