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
- +lightGrayColor
- +magentaColor
- +orangeColor
- +purpleColor
- +redColor
- +scrollBarColor
- +secondarySelectedControlColor
- +selectedControlColor
- +selectedControlTextColor
- +selectedKnobColor
- +selectedMenuItemColor
- +selectedMenuItemTextColor
- +selectedTextBackgroundColor
- +selectedTextColor
- +setIgnoresAlpha:
- +shadowColor
- +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: Not in OpenStep/MacOS-X
Description forthcoming.

### alternateSelectedControlTextColor

+ (NSColor*) alternateSelectedControlTextColor;
Availability: Not in OpenStep/MacOS-X
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: (float)hue saturation: (float)saturation brightness: (float)brightness alpha: (float)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: (float)red green: (float)green blue: (float)blue alpha: (float)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: (float)white alpha: (float)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 float*)comp count: (int)number;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

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

+ (NSColor*) colorWithDeviceCyan: (float)cyan magenta: (float)magenta yellow: (float)yellow black: (float)black alpha: (float)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: (float)hue saturation: (float)saturation brightness: (float)brightness alpha: (float)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: (float)red green: (float)green blue: (float)blue alpha: (float)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: (float)white alpha: (float)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: Not in OpenStep/MacOS-X
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: Not in OpenStep/MacOS-X
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.

### 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:

### 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.

### 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.

### 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

- (float) alphaComponent;
Availability: OpenStep

Returns the alpha component.

### blackComponent

- (float) blackComponent;
Availability: OpenStep

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

### blendedColorWithFraction: ofColor:

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

### blueComponent

- (float) blueComponent;
Availability: OpenStep

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

### brightnessComponent

- (float) 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: Not in OpenStep/MacOS-X
Description forthcoming.

### colorSpaceName

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

### colorUsingColorSpace:

- (NSColor*) colorUsingColorSpace: (NSColorSpace*)space;
Availability: Not in OpenStep/MacOS-X
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: (float)alpha;
Availability: OpenStep
Description forthcoming.

### cyanComponent

- (float) 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: (float*)components;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

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

- (void) getCyan: (float*)cyan magenta: (float*)magenta yellow: (float*)yellow black: (float*)black alpha: (float*)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: (float*)hue saturation: (float*)saturation brightness: (float*)brightness alpha: (float*)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: (float*)red green: (float*)green blue: (float*)blue alpha: (float*)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: (float*)white alpha: (float*)alpha;
Availability: OpenStep

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

### greenComponent

- (float) greenComponent;
Availability: OpenStep

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

### highlightWithLevel:

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

### hueComponent

- (float) 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

- (float) magentaComponent;
Availability: OpenStep

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

### numberOfComponents

- (int) numberOfComponents;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### patternImage

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

### redComponent

- (float) redComponent;
Availability: OpenStep

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

### saturationComponent

- (float) 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: Not in OpenStep/MacOS-X
Description forthcoming.

### setStroke

- (void) setStroke;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### shadowWithLevel:

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

### whiteComponent

- (float) 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

- (float) 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