You may think too hard. If I understand your problem correctly, the only thing you really want to do is set the text style. Then do it simply using:
[[object cell] setBackgroundStyle:NSBackgroundStyleRaised];
where object is an instance of the NSTextField class.
This is all for you. Then your gradient background can be achieved, for example, with a custom view using NSGradient. See here
Advantage: you have the proper instance of NSTextField without having to subclass it or do other unnecessary things, such as implementing everything that NSTextField does on its own in the NSView subclass.
source share