Standard highlighting color in OS X applications is blue.
Is it possible to change it to another color, e.g. gray?
Note that I am using the new view-based
I've mixed all methods described before and got code that exactly do what I want.
Any strange outer borders and other leftovers appear.
class AudioCellView: NSTableRowView {
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
self.wantsLayer = true
self.layer?.backgroundColor = NSColor.white.cgColor
}
override var isEmphasized: Bool {
set {}
get {
return false
}
}
override var selectionHighlightStyle: NSTableView.SelectionHighlightStyle {
set {}
get {
return .regular
}
}
override func drawSelection(in dirtyRect: NSRect) {
if self.selectionHighlightStyle != .none {
let selectionRect = NSInsetRect(self.bounds, 2.5, 2.5)
NSColor(calibratedWhite: 0.85, alpha: 0.6).setFill()
let selectionPath = NSBezierPath.init(rect: selectionRect)
selectionPath.fill()
}
}
}