How to change the focusing effect on NSTextField on OSX

In CSS, you can change the effect of focusing on something using:

.myelement:focus { ... } 

In Cocoa, text fields always have an ugly blue glow. How to change the focusing effect on NSTextField (or do nothing at all)?

+6
source share
1 answer

Cocoa equivalent command above:

 [[textField window] makeFirstResponder:textField]; 

Regarding the change in appearance, you ask how to change it for all controls in all applications (“globally”) or just for a text field in your own application? There is no API for global changes, so system hacks are your only way. Good luck.

For the controls you control (those that belong to your own application), you can set the type of focus ring in Interface Builder or the runtime code as follows:

 [textField setFocusRingType:NSFocusRingTypeNone]; // (or NSFocusRingTypeDefault or NSFocusRingTypeExterior) 
+12
source

Source: https://habr.com/ru/post/917558/