The default value for [NSTextView selectedTextAttributes]
is unusable in my app, because i allow the user to select colors (syntax highlighting) that are almost exactly the same as the background color.
I have written some math to determine a suitable color and can use this to set it:
textView.selectedTextAttributes = @{
NSBackgroundColorAttributeName: [NSColor yellowColor],
NSForegroundColorAttributeName: [NSColor redColor]
};
But when the window is in the background, it still uses the system default light grey.
I've attached screenshots of the above code with active vs inactive window. — how can I change the selected text background colour of the inactive window?
resignKeyWindow
? – SwadeshiNSTextView
)? Reference here. – IslekfieldEditor
is only used by "simple" controls such asNSTextField
.NSTextView
probably doesn't use it. – Belenbelesprit