react-native-macos icon indicating copy to clipboard operation
react-native-macos copied to clipboard

tintColor style property not having any effect

Open bbqsrc opened this issue 8 years ago • 2 comments

The UIExplorer test app shows the issue:

screen shot 2017-04-15 at 15 27 20

As you can see, they're all the same color when they should not be. 😉

bbqsrc avatar Apr 15 '17 05:04 bbqsrc

Yes, NSImage has no tintColor as UIImage on iOS does. So currently it's like a placeholder. Although, I can implement it by applying image transformations.

ptmt avatar Apr 15 '17 05:04 ptmt

Yeah, my current experimentation with that has got me to here:

extension NSImage {
    func tint(color: NSColor) {
        lockFocus()
        color.set()
        NSRectFillUsingOperation(NSMakeRect(0, 0, self.size.width, self.size.height), .sourceAtop)
        unlockFocus()
        isTemplate = false
    }
}

bbqsrc avatar Apr 15 '17 05:04 bbqsrc