Rendering control images in Dark Mode

Graham Cox

Hi all,

I have some custom controls (views) that I’m updating to be Dark Mode aware.

The view’s background is filled using the relevant semantic colour (controlBackgroundColor), and the icon is rendered using NSImage -drawInRect:… method using NSCompositngOperationSourceOver. The image has isTemplate set to YES, but the image is rendering as black rather than white (or light, anyway).

What magic do I have to do to get the template image to render appropriately in both Dark and Light mode? The documentation (and release notes) don’t seem to explain this.


Join { to automatically receive all group messages.