Name
NSColor — Mac OS X 10.0
Synopsis
This class represents a color in the Application Kit. Each color has
a colorspace
associated with it, and the color components that are recognized by
that color space. NSColor supports six color
spaces identified by the following constants:
NSDeviceCMYKColorSpaceNSDeviceWhiteColorSpaceNSDeviceRGBColorNSCalibratedWhiteColorSpaceNSCalibratedRGBColorSpaceNSNamedColorSpace
Calibrated colorspaces use Apple’s ColorSync technology to ensure that colors look the same on all output devices. Device colorspaces, on the other hand, do not employ ColorSync calibration, and the appearance of colors is thus device-dependent.
The set method is one of the most commonly used
methods of NSColor, as it sets the color that all
subsequent drawing operations should use. NSColor
declares a number of methods for determining the values of various
color components, converting colors between colorspaces, creating
NSColor objects by changing components of an
existing color object, and more. Additionally, there are a number of
convenience contructors such as blueColor,
redColor, and blackColor that
return premade colors without having to specify component values.
|
![]()
|
@interface NSColor : NSObject <NSCoding, NSCopying>
|
// Convenience Constructors
|
+ (NSColor *)colorForControlTint:(NSControlTint)controlTint; |
+ (NSColor *)colorFromPasteboard:(NSPasteboard *)pasteBoard ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
