Skip to content

Expose template image control for macOS tray icons #47

@lijy91

Description

@lijy91

Problem

On macOS, status bar icons often need explicit control over whether the underlying NSImage is rendered as a template image.

For monochrome status bar symbols, template rendering is useful because AppKit can adapt the icon color to light and dark menu bar appearances. For full-color or filled icons, however, template rendering can be undesirable: an image with an opaque filled shape and internal details may render as a single solid status-bar colored block because the image is treated as a mask.

The current tray icon API does not appear to expose a way to opt in or out of this behavior.

Expected behavior

There should be a public API to explicitly choose template rendering behavior for macOS tray icons.

For example, nativeapi could expose one of these concepts:

  • an is_template property on images
  • a tray icon image setter that accepts a template-rendering flag
  • separate APIs for setting template and non-template tray images

This would allow callers to choose between:

  • template icons that adapt to menu bar appearance
  • non-template icons that preserve source colors, filled backgrounds, and internal details

Actual behavior

There is no public API to control this. On macOS, filled tray icons can appear as a solid block when template rendering is applied or inferred.

Environment

  • Platform: macOS
  • API surface: tray icon image assignment
  • Affected concept: NSImage.isTemplate

Suggested fix

Expose template rendering control in the nativeapi image or tray icon API, and map it to NSImage.isTemplate on macOS. Other platforms could ignore the flag or document platform-specific behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions