Up

# NSColor

### Authors

Scott Christley (`scottc@net-community.com`)
Fred Kiefer (`fredkiefer@gmx.de`)

> The colorful color class

Copyright: (C) 1996, 1998, 2001, 2002 Free Software Foundation, Inc.

### Contents -

1. Software documentation for the NSColor class
2. Software documentation for the NSCoder(NSCoderAdditions) category

# Software documentation for the NSColor class

## NSColor : NSObject

> Declared in:
>   AppKit/NSColor.h

> Conforms to:
>   NSCoding
>   NSCopying

Availability: OpenStep

TODO NSColor description

Method summary

- +alternateSelectedControlColor
- +alternateSelectedControlTextColor
- +blackColor
- +blueColor
- +brownColor
- +clearColor
- +colorForControlTint:
- +colorFromPasteboard:
- +colorWithCalibratedHue:saturation:brightness:alpha:
- +colorWithCalibratedRed:green:blue:alpha:
- +colorWithCalibratedWhite:alpha:
- +colorWithCatalogName:colorName:
- +colorWithColorSpace:components:count:
- +colorWithDeviceCyan:magenta:yellow:black:alpha:
- +colorWithDeviceHue:saturation:brightness:alpha:
- +colorWithDeviceRed:green:blue:alpha:
- +colorWithDeviceWhite:alpha:
- +colorWithPatternImage:
- +controlAlternatingRowBackgroundColors
- +controlBackgroundColor
- +controlColor
- +controlDarkShadowColor
- +controlHighlightColor
- +controlLightHighlightColor
- +controlShadowColor
- +controlTextColor
- +currentControlTint
- +cyanColor
- +darkGrayColor
- +disabledControlTextColor
- +grayColor
- +greenColor
- +gridColor
- +headerColor
- +headerTextColor
- +highlightColor
- +ignoresAlpha
- +keyboardFocusIndicatorColor
- +knobColor
- +labelColor
- +lightGrayColor
- +magentaColor
- +orangeColor
- +purpleColor
- +quaternaryLabelColor
- +redColor
- +scrollBarColor
- +secondaryLabelColor
- +secondarySelectedControlColor
- +selectedControlColor
- +selectedControlTextColor
- +selectedKnobColor
- +selectedMenuItemColor
- +selectedMenuItemTextColor
- +selectedTextBackgroundColor
- +selectedTextColor
- +setIgnoresAlpha:
- +shadowColor
- +tertiaryLabelColor
- +textBackgroundColor
- +textColor
- +whiteColor
- +windowBackgroundColor
- +windowFrameColor
- +windowFrameTextColor
- +yellowColor
- -alphaComponent
- -blackComponent
- -blendedColorWithFraction:ofColor:
- -blueComponent
- -brightnessComponent
- -catalogNameComponent
- -colorNameComponent
- -colorSpace
- -colorSpaceName
- -colorUsingColorSpace:
- -colorUsingColorSpaceName:
- -colorUsingColorSpaceName:device:
- -colorWithAlphaComponent:
- -cyanComponent
- -drawSwatchInRect:
- -getComponents:
- -getCyan:magenta:yellow:black:alpha:
- -getHue:saturation:brightness:alpha:
- -getRed:green:blue:alpha:
- -getWhite:alpha:
- -greenComponent
- -highlightWithLevel:
- -hueComponent
- -localizedCatalogNameComponent
- -localizedColorNameComponent
- -magentaComponent
- -numberOfComponents
- -patternImage
- -redComponent
- -saturationComponent
- -set
- -setFill
- -setStroke
- -shadowWithLevel:
- -whiteComponent
- -writeToPasteboard:
- -yellowComponent

### alternateSelectedControlColor

+ (NSColor*) alternateSelectedControlColor;
Availability: MacOS-X 10.2.0
Description forthcoming.

### alternateSelectedControlTextColor

+ (NSColor*) alternateSelectedControlTextColor;
Availability: MacOS-X 10.2.0
Description forthcoming.

### blackColor

+ (NSColor*) blackColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedWhiteColorSpace space name. with white and alpha values set as NSBlack and 1.0 respectively.

See Also : +colorWithCalibratedWhite:alpha:

### blueColor

+ (NSColor*) blueColor;
Availability: OpenStep

Returns an NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 0.0, 0.0, 1.0 and 1.0 respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

### brownColor

+ (NSColor*) brownColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 0.6, 0.4, 0.2 and 1.0 respectively.

See Also: +colorWithCalibratedRed:green:blue:alpha:

### clearColor

+ (NSColor*) clearColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedWhiteColorSpace space name. with white and alpha values set as 0.0 and 1.0 respectively.

See Also : +colorWithCalibratedWhite:alpha:

### colorForControlTint:

+ (NSColor*) colorForControlTint: (NSControlTint)controlTint;
Availability: MacOS-X 10.0.0
Description forthcoming.

### colorFromPasteboard:

+ (NSColor*) colorFromPasteboard: (NSPasteboard*)pasteBoard;
Availability: OpenStep

Returns the NSColor on the NSPasteboard pasteBoard or `nil` if it does not exists.

See Also: -writeToPasteboard:

### colorWithCalibratedHue: saturation: brightness: alpha:

+ (NSColor*) colorWithCalibratedHue: (CGFloat)hue saturation: (CGFloat)saturation brightness: (CGFloat)brightness alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSCalibratedRGBColorSpace space name, with hue, saturation, brightness and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithCalibratedRed: green: blue: alpha:

+ (NSColor*) colorWithCalibratedRed: (CGFloat)red green: (CGFloat)green blue: (CGFloat)blue alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSCalibratedRGBColorSpace space name, with red, green, blue and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithCalibratedWhite: alpha:

+ (NSColor*) colorWithCalibratedWhite: (CGFloat)white alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSCalibratedWhiteColorSpace space name, with red, green, blue and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithCatalogName: colorName:

+ (NSColor*) colorWithCatalogName: (NSString*)listName colorName: (NSString*)colorName;
Availability: OpenStep

TODO

### colorWithColorSpace: components: count:

+ (NSColor*) colorWithColorSpace: (NSColorSpace*)space components: (const CGFloat*)comp count: (NSInteger)number;
Availability: MacOS-X 10.4.0
Description forthcoming.

### colorWithDeviceCyan: magenta: yellow: black: alpha:

+ (NSColor*) colorWithDeviceCyan: (CGFloat)cyan magenta: (CGFloat)magenta yellow: (CGFloat)yellow black: (CGFloat)black alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSDeviceCMYKColorSpace space name, with cyan, magenta, yellow, black and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithDeviceHue: saturation: brightness: alpha:

+ (NSColor*) colorWithDeviceHue: (CGFloat)hue saturation: (CGFloat)saturation brightness: (CGFloat)brightness alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSDeviceCMYKColorSpace space name, with hue, saturation, brightness and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithDeviceRed: green: blue: alpha:

+ (NSColor*) colorWithDeviceRed: (CGFloat)red green: (CGFloat)green blue: (CGFloat)blue alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSDeviceCMYKColorSpace space name, with red, green, blue and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithDeviceWhite: alpha:

+ (NSColor*) colorWithDeviceWhite: (CGFloat)white alpha: (CGFloat)alpha;
Availability: OpenStep

Creates and returns a new NSColor in a NSDeviceWhiteColorSpace space name, with red, green, blue and alpha as specified. Valid values are the range 0.0 to 1.0. Out of range values will be clipped.

### colorWithPatternImage:

+ (NSColor*) colorWithPatternImage: (NSImage*)image;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlAlternatingRowBackgroundColors

+ (NSArray*) controlAlternatingRowBackgroundColors;
Availability: MacOS-X 10.3.0
Description forthcoming.

### controlBackgroundColor

+ (NSColor*) controlBackgroundColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlColor

+ (NSColor*) controlColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlDarkShadowColor

+ (NSColor*) controlDarkShadowColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlHighlightColor

+ (NSColor*) controlHighlightColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlLightHighlightColor

+ (NSColor*) controlLightHighlightColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlShadowColor

+ (NSColor*) controlShadowColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### controlTextColor

+ (NSColor*) controlTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### currentControlTint

+ (NSControlTint) currentControlTint;
Availability: MacOS-X 10.3.0
Description forthcoming.

### cyanColor

+ (NSColor*) cyanColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 0.0, 1.0, 1.0 and 1.0 respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

### darkGrayColor

+ (NSColor*) darkGrayColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedWhiteColorSpace space name. with white and alpha values set as NSDarkGray and 1.0 respectively.

See Also : +colorWithCalibratedWhite:alpha:

### disabledControlTextColor

+ (NSColor*) disabledControlTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### grayColor

+ (NSColor*) grayColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedWhiteColorSpace space name. with white and alpha values set as NSGray and 1.0 respectively.

See Also: +colorWithCalibratedWhite:alpha:

### greenColor

+ (NSColor*) greenColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 0.0, 1.0, 0.0 and 1.0 respectively

See Also: +colorWithCalibratedRed:green:blue:alpha:

### gridColor

+ (NSColor*) gridColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### headerColor

+ (NSColor*) headerColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### headerTextColor

+ (NSColor*) headerTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### highlightColor

+ (NSColor*) highlightColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### ignoresAlpha

+ (BOOL) ignoresAlpha;
Availability: OpenStep
Returns whether TODO

See Also: +setIgnoresAlpha:

### keyboardFocusIndicatorColor

+ (NSColor*) keyboardFocusIndicatorColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### knobColor

+ (NSColor*) knobColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### labelColor

+ (NSColor*) labelColor;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### lightGrayColor

+ (NSColor*) lightGrayColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedWhiteColorSpace space name. with white and alpha values set as NSLightGray and 1.0 respectively

See Also : +colorWithCalibratedRed:green:blue:alpha:

### magentaColor

+ (NSColor*) magentaColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 1.0, 0.0, 1.0 and 1.0 respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

### orangeColor

+ (NSColor*) orangeColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 1.0, 0.5, 0.0 and 1.0 respectively.

See Also: +colorWithCalibratedRed:green:blue:alpha:

### purpleColor

+ (NSColor*) purpleColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 0.5, 0.0, 0.5 and 1.0 respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

### quaternaryLabelColor

+ (NSColor*) quaternaryLabelColor;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### redColor

+ (NSColor*) redColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 1.0, 0.0, 0.0 and 1.0 respectively

See Also: +colorWithCalibratedRed:green:blue:alpha:

### scrollBarColor

+ (NSColor*) scrollBarColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### secondaryLabelColor

+ (NSColor*) secondaryLabelColor;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### secondarySelectedControlColor

+ (NSColor*) secondarySelectedControlColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedControlColor

+ (NSColor*) selectedControlColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedControlTextColor

+ (NSColor*) selectedControlTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedKnobColor

+ (NSColor*) selectedKnobColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedMenuItemColor

+ (NSColor*) selectedMenuItemColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedMenuItemTextColor

+ (NSColor*) selectedMenuItemTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedTextBackgroundColor

+ (NSColor*) selectedTextBackgroundColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### selectedTextColor

+ (NSColor*) selectedTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setIgnoresAlpha:

+ (void) setIgnoresAlpha: (BOOL)flag;
Availability: OpenStep
TODO

See Also: +ignoresAlpha

### shadowColor

+ (NSColor*) shadowColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### tertiaryLabelColor

+ (NSColor*) tertiaryLabelColor;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### textBackgroundColor

+ (NSColor*) textBackgroundColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### textColor

+ (NSColor*) textColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### whiteColor

+ (NSColor*) whiteColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedWhiteColorSpace space name. with white and alpha values set as NSWhite and 1.0 respectively.

See Also : +colorWithCalibratedWhite:alpha:

### windowBackgroundColor

+ (NSColor*) windowBackgroundColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### windowFrameColor

+ (NSColor*) windowFrameColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### windowFrameTextColor

+ (NSColor*) windowFrameTextColor;
Availability: MacOS-X 10.0.0
Description forthcoming.

### yellowColor

+ (NSColor*) yellowColor;
Availability: OpenStep

Returns a NSColor in a NSCalibratedRGBColorSpace space name. with red, green, blue and alpha values set as 1.0, 0.0, 0.0 and 1.0 respectively.

See Also : +colorWithCalibratedRed:green:blue:alpha:

### alphaComponent

- (CGFloat) alphaComponent;
Availability: OpenStep

Returns the alpha component.

### blackComponent

- (CGFloat) blackComponent;
Availability: OpenStep

Returns the black component. Raises a NSInternalInconsistencyException if NSColor is not a CMYK color.

### blendedColorWithFraction: ofColor:

- (NSColor*) blendedColorWithFraction: (CGFloat)fraction ofColor: (NSColor*)aColor;
Availability: OpenStep
Description forthcoming.

### blueComponent

- (CGFloat) blueComponent;
Availability: OpenStep

Returns the blue component. Raises a NSInternalInconsistencyException if NSColor is not a RGB color.

### brightnessComponent

- (CGFloat) brightnessComponent;
Availability: OpenStep

Returns the brightness component. Raises a NSInternalInconsistencyException if NSColor space is not a RGB color

### catalogNameComponent

- (NSString*) catalogNameComponent;
Availability: OpenStep
Description forthcoming.

### colorNameComponent

- (NSString*) colorNameComponent;
Availability: OpenStep
Description forthcoming.

### colorSpace

- (NSColorSpace*) colorSpace;
Availability: MacOS-X 10.4.0
Description forthcoming.

### colorSpaceName

- (NSString*) colorSpaceName;
Availability: OpenStep
Description forthcoming.

### colorUsingColorSpace:

- (NSColor*) colorUsingColorSpace: (NSColorSpace*)space;
Availability: MacOS-X 10.4.0
Description forthcoming.

### colorUsingColorSpaceName:

- (NSColor*) colorUsingColorSpaceName: (NSString*)colorSpace;
Availability: OpenStep
Description forthcoming.

### colorUsingColorSpaceName: device:

- (NSColor*) colorUsingColorSpaceName: (NSString*)colorSpace device: (NSDictionary*)deviceDescription;
Availability: OpenStep
Description forthcoming.

### colorWithAlphaComponent:

- (NSColor*) colorWithAlphaComponent: (CGFloat)alpha;
Availability: OpenStep
Description forthcoming.

### cyanComponent

- (CGFloat) cyanComponent;
Availability: OpenStep

Returns the cyan component. Raises a NSInternalInconsistencyException if NSColor is not a CYMK color

### drawSwatchInRect:

- (void) drawSwatchInRect: (NSRect)rect;
Availability: OpenStep
Description forthcoming.

### getComponents:

- (void) getComponents: (CGFloat*)components;
Availability: MacOS-X 10.4.0
Description forthcoming.

### getCyan: magenta: yellow: black: alpha:

- (void) getCyan: (CGFloat*)cyan magenta: (CGFloat*)magenta yellow: (CGFloat*)yellow black: (CGFloat*)black alpha: (CGFloat*)alpha;
Availability: OpenStep

Gets the cyan, magenta, yellow,black and alpha values from the NSColor. Raises a NSInternalInconsistencyException if the NSColor is not a CYMK color

### getHue: saturation: brightness: alpha:

- (void) getHue: (CGFloat*)hue saturation: (CGFloat*)saturation brightness: (CGFloat*)brightness alpha: (CGFloat*)alpha;
Availability: OpenStep

Gets the hue, saturation, brightness and alpha values from the NSColor. Raises a NSInternalInconsistencyException if the NSColor is not a RGB color

### getRed: green: blue: alpha:

- (void) getRed: (CGFloat*)red green: (CGFloat*)green blue: (CGFloat*)blue alpha: (CGFloat*)alpha;
Availability: OpenStep

Gets the red, green, blue and alpha values from the NSColor. Raises a NSInternalInconsistencyException if the NSColor is not a RGB color

### getWhite: alpha:

- (void) getWhite: (CGFloat*)white alpha: (CGFloat*)alpha;
Availability: OpenStep

Gets the white alpha values from the NSColor. Raises a NSInternalInconsistencyException if the NSColor is not a greyscale color

### greenComponent

- (CGFloat) greenComponent;
Availability: OpenStep

Returns the green component. Raises a NSInternalInconsistencyException if NSColor is not a RGB color

### highlightWithLevel:

- (NSColor*) highlightWithLevel: (CGFloat)level;
Availability: MacOS-X 10.0.0
Description forthcoming.

### hueComponent

- (CGFloat) hueComponent;
Availability: OpenStep

Returns the hue component. Raises a NSInternalInconsistencyException if NSColor is not a RGB color

### localizedCatalogNameComponent

- (NSString*) localizedCatalogNameComponent;
Availability: OpenStep
Description forthcoming.

### localizedColorNameComponent

- (NSString*) localizedColorNameComponent;
Availability: OpenStep
Description forthcoming.

### magentaComponent

- (CGFloat) magentaComponent;
Availability: OpenStep

Returns the magenta component. Raises a NSInternalInconsistencyException if NSColor is not a CMYK color

### numberOfComponents

- (NSInteger) numberOfComponents;
Availability: MacOS-X 10.4.0
Description forthcoming.

### patternImage

- (NSImage*) patternImage;
Availability: MacOS-X 10.0.0
Description forthcoming.

### redComponent

- (CGFloat) redComponent;
Availability: OpenStep

Returns the red component. Raises a NSInternalInconsistencyException if NSColor is not a RGB color

### saturationComponent

- (CGFloat) saturationComponent;
Availability: OpenStep

Returns the saturation component. Raises a NSInternalInconsistencyException if NSColor is not a RGB color

### set

- (void) set;
Availability: OpenStep
Description forthcoming.

### setFill

- (void) setFill;
Availability: MacOS-X 10.3.0
Description forthcoming.

### setStroke

- (void) setStroke;
Availability: MacOS-X 10.3.0
Description forthcoming.

### shadowWithLevel:

- (NSColor*) shadowWithLevel: (CGFloat)level;
Availability: MacOS-X 10.0.0
Description forthcoming.

### whiteComponent

- (CGFloat) whiteComponent;
Availability: OpenStep

Returns the white component. Raises a NSInternalInconsistencyException if NSColor is not a grayscale color

### writeToPasteboard:

- (void) writeToPasteboard: (NSPasteboard*)pasteBoard;
Availability: OpenStep

Writes the NSColor into the NSPasteboard specified by pasteBoard

See Also: +colorFromPasteboard:

### yellowComponent

- (CGFloat) yellowComponent;
Availability: OpenStep

Returns the yellow component. Raises a NSInternalInconsistencyException if NSColor is not a RGB color

# Software documentation for the NSCoder(NSCoderAdditions) category

## NSCoder(NSCoderAdditions)

> Declared in:
>   AppKit/NSColor.h

Availability: Not in OpenStep/MacOS-X
Description forthcoming.
Method summary

- -decodeNXColor

### decodeNXColor

- (NSColor*) decodeNXColor;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

Up