one more thing, the code above is perfect, however, if you have multiple windows you will need to check if your window is key.
if (controlView && ([[controlView window] firstResponder] == controlView) && [[controlView window] isKeyWindow]) { [attributes setObject:[NSColor whiteColor] forKey:NSForegroundColorAttributeName]; }
Klajd deda
source share