Add NSImage extension

This commit is contained in:
Ivan Grachev 2022-08-30 18:27:03 +03:00
parent 587e3bea86
commit d596444f4e
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,17 @@
// Copyright © 2022 Tokenary. All rights reserved.
import Cocoa
extension NSImage {
func tinted(_ tintColor: NSColor) -> NSImage {
guard isTemplate else { return self }
lockFocus()
tintColor.set()
NSRect(origin: .zero, size: size).fill(using: .sourceAtop)
unlockFocus()
isTemplate = false
return self
}
}

View File

@ -225,6 +225,7 @@
2CF255B6275A746000AE54B9 /* AccountsListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF255B5275A746000AE54B9 /* AccountsListViewController.swift */; };
2CF255B8275A748300AE54B9 /* ApproveTransactionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF255B7275A748300AE54B9 /* ApproveTransactionViewController.swift */; };
2CF255BA275A749300AE54B9 /* ApproveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF255B9275A749300AE54B9 /* ApproveViewController.swift */; };
2CFAE56A28BE6292001D0799 /* NSImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFAE56928BE6292001D0799 /* NSImage.swift */; };
2CFDDF4C2765416F00F89019 /* macos-specific-content.js in Resources */ = {isa = PBXBuildFile; fileRef = 2CFDDF4B2765416F00F89019 /* macos-specific-content.js */; };
2CFDDF4E2765417E00F89019 /* ios-specific-content.js in Resources */ = {isa = PBXBuildFile; fileRef = 2CFDDF4D2765417D00F89019 /* ios-specific-content.js */; };
E1F659197E90BA26C3A3A6EE /* Pods_Tokenary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80697A23D681CBF87CF830B1 /* Pods_Tokenary.framework */; };
@ -424,6 +425,7 @@
2CF255B5275A746000AE54B9 /* AccountsListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsListViewController.swift; sourceTree = "<group>"; };
2CF255B7275A748300AE54B9 /* ApproveTransactionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApproveTransactionViewController.swift; sourceTree = "<group>"; };
2CF255B9275A749300AE54B9 /* ApproveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApproveViewController.swift; sourceTree = "<group>"; };
2CFAE56928BE6292001D0799 /* NSImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSImage.swift; sourceTree = "<group>"; };
2CFDDF4B2765416F00F89019 /* macos-specific-content.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "macos-specific-content.js"; sourceTree = "<group>"; };
2CFDDF4D2765417D00F89019 /* ios-specific-content.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "ios-specific-content.js"; sourceTree = "<group>"; };
3238B55CC74B94A606D08A98 /* Pods-Tokenary iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tokenary iOS.debug.xcconfig"; path = "Target Support Files/Pods-Tokenary iOS/Pods-Tokenary iOS.debug.xcconfig"; sourceTree = "<group>"; };
@ -649,6 +651,7 @@
isa = PBXGroup;
children = (
2C6B964B26B9D92500D2C819 /* NSColor.swift */,
2CFAE56928BE6292001D0799 /* NSImage.swift */,
2CD0B3F426A0DAA900488D92 /* NSPasteboard.swift */,
2CB4031C281D745D00BAEBEE /* NSTableView.swift */,
);
@ -1404,6 +1407,7 @@
2C528A16267FA8EB00CA3ADD /* Defaults.swift in Sources */,
2C264BE127B5AC6000234393 /* SolanaResponseToExtension.swift in Sources */,
2C264BBC27B2F25E00234393 /* SafariRequest.swift in Sources */,
2CFAE56A28BE6292001D0799 /* NSImage.swift in Sources */,
2CD0B3F526A0DAA900488D92 /* NSPasteboard.swift in Sources */,
2C2AA1D528AFB1AD00E35DBF /* MultipleResponseToExtension.swift in Sources */,
2C264BEB27B6B50700234393 /* DappRequestProcessor.swift in Sources */,