---
title: "getComponents(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscolor/getcomponents(_:)"
---

# getComponents(_:)

Returns the components of the color as an array.

## Declaration

```swift
func getComponents(_ components: UnsafeMutablePointer<CGFloat>)
```

## Parameters

- `components`: An array containing the components of the color object as float values.

## Discussion

Discussion You can invoke this method on NSColor objects created from custom color spaces to get the individual floating-point components, including alpha. Raises an exception if the receiver doesn’t have floating-point components. To find out how many components are in the components array, use the numberOfComponents property.

## See Also

### Related Documentation

- [colorSpace](appkit/nscolor/colorspace.md)

### Retrieving component values from color objects

- [getCyan(_:magenta:yellow:black:alpha:)](appkit/nscolor/getcyan(_:magenta:yellow:black:alpha:).md)
- [getHue(_:saturation:brightness:alpha:)](appkit/nscolor/gethue(_:saturation:brightness:alpha:).md)
- [getRed(_:green:blue:alpha:)](appkit/nscolor/getred(_:green:blue:alpha:).md)
- [getWhite(_:alpha:)](appkit/nscolor/getwhite(_:alpha:).md)
- [numberOfComponents](appkit/nscolor/numberofcomponents.md)
