Skip to content

fix(macos): enable template rendering for monochrome tray icons - #218

Closed
kjm0202 wants to merge 1 commit into
LizardByte:masterfrom
kjm0202:fix/macos-template-icons
Closed

kjm0202 wants to merge 1 commit into
LizardByte:masterfrom
kjm0202:fix/macos-template-icons

Conversation

@kjm0202

@kjm0202 kjm0202 commented Nov 16, 2026

Copy link
Copy Markdown

Description

Mark macOS tray icons beginning with macos-tray- as template images via result.setIsMask(true).

On macOS Cocoa, Qt sets the native NSImage template flag from QIcon::isMask(). Marking monochrome menu bar icons as templates enables macOS to automatically adapt their rendering across light and dark appearances (and with accessibility contrast settings such as Reduce Transparency), ensuring white monochrome icons invert to dark/black on light backgrounds instead of losing contrast.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Verified on macOS that QIcon::setIsMask(true) properly activates template rendering so that monochrome status bar icons invert dynamically to dark/black on light menu bar backgrounds and remain white on dark backgrounds.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

@sonarqubecloud

Copy link
Copy Markdown

Copy link
Copy Markdown
Member

I suggested this filename-prefix implementation in the Sunshine review, so I want to correct that guidance: fixing Sunshine's white-icon contrast does not by itself justify putting Sunshine-specific filename policy into this shared library.

At ba93bc3b, the scope is macOS file-backed icons whose basename starts with macos-tray-, not all consumers' icons. But the match is implicit, and lookupIcon() is also used for notification icons. I should have separated the valid contrast finding from the library design decision instead of prescribing this implementation.

Please don't treat this PR as a required dependency change on my account. Keeping Sunshine's existing artwork is a no-library-change option. If template support is wanted here, an explicit opt-in that preserves existing defaults is an alternative for maintainer consideration, not a demand to add a new feature. I haven't tested native macOS rendering independently.

Review completed by Codex | Model: unavailable | Thinking: unavailable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants