---
title: "getRed(_:green:blue:alpha:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscolor/getred(_:green:blue:alpha:)"
---

# getRed(_:green:blue:alpha:)

Returns the color object’s RGB component and opacity values in the respective arguments.

## Declaration

```swift
func getRed(_ red: UnsafeMutablePointer<CGFloat>?, green: UnsafeMutablePointer<CGFloat>?, blue: UnsafeMutablePointer<CGFloat>?, alpha: UnsafeMutablePointer<CGFloat>?)
```

## Parameters

- `red`: Upon return, contains the red component of the color object.
- `green`: Upon return, contains the green component of the color object.
- `blue`: Upon return, contains the blue component of the color object.
- `alpha`: Upon return, contains the opacity value of the color object.

## Discussion

Discussion If NULL is passed in as an argument, the method doesn’t set that value. This method works only with objects representing colors in the calibratedRGB or deviceRGB color space. Sending it to other objects raises an exception.

## See Also

### Related Documentation

- [blueComponent](appkit/nscolor/bluecomponent.md)
- [redComponent](appkit/nscolor/redcomponent.md)
- [alphaComponent](appkit/nscolor/alphacomponent.md)
- [greenComponent](appkit/nscolor/greencomponent.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)
- [getWhite(_:alpha:)](appkit/nscolor/getwhite(_:alpha:).md)
- [numberOfComponents](appkit/nscolor/numberofcomponents.md)
- [getComponents(_:)](appkit/nscolor/getcomponents(_:).md)
