For the More Curious: More on NSColor

The intricacies of the NSColor class are beyond the scope of this book, but the basics are sufficient for most Cocoa programming.

NSColor provides a number of class methods returning common colors. Here is a sampling:

 ​ ​c​l​a​s​s​ ​f​u​n​c​ ​b​l​a​c​k​C​o​l​o​r​(​)​ ​-​>​ ​N​S​C​o​l​o​r​
 ​ ​c​l​a​s​s​ ​f​u​n​c​ ​p​u​r​p​l​e​C​o​l​o​r​(​)​ ​-​>​ ​N​S​C​o​l​o​r​
 ​ ​c​l​a​s​s​ ​f​u​n​c​ ​c​l​e​a​r​C​o​l​o​r​(​)​ ​-​>​ ​N​S​C​o​l​o​r​

If you are creating custom controls, you will often want them to blend in with the system. Since colors used in the system can vary from major releases of OS X, and since some colors (such as the highlight color) are configurable by the user, NSColor provides class ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.