NSColor Class

The NSColor class is the public interface to a class cluster that encompasses the concept of a color in Cocoa. It is an immutable class, meaning a new instance can be created, but it is not possible to modify the contents of an existing NSColor instance.

An NSColor instance represents a unique location in a color space. The most common color space when dealing with computer displays is RGB (red, green, blue), whereas in printing CMYK (cyan, magenta, yellow, black) is the standard.

The location components of an NSColor are float values between 0.0 and 1.0. For example, in RGB color space, 0.0,1.0,0.0 would represent a pure green.

Each color can also have a transparency level associated with it, referred to as an alpha value. An ...

Get Cocoa® Programming 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.