<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGDisplayFade(_:_:_:_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGDisplayFade"
  },
  "title" : "CGDisplayFade(_:_:_:_:_:_:_:_:)"
}
-->

# CGDisplayFade(_:_:_:_:_:_:_:_:)

Performs a single fade operation.

```
func CGDisplayFade(_ token: CGDisplayFadeReservationToken, _ duration: CGDisplayFadeInterval, _ startBlend: CGDisplayBlendFraction, _ endBlend: CGDisplayBlendFraction, _ redBlend: Float, _ greenBlend: Float, _ blueBlend: Float, _ synchronous: boolean_t) -> CGError
```

## Parameters

`token`

A reservation token for the fade hardware you acquire by calling [`CGAcquireDisplayFadeReservation(_:_:)`](/documentation/CoreGraphics/CGAcquireDisplayFadeReservation(_:_:)).

`duration`

The desired number of seconds for the fade operation. You should use a value in the interval `[0, kCGMaxDisplayReservationInterval`]. If the value is `0`, Quartz applies the ending blend color immediately.

`startBlend`

An intensity value in the interval `[0, 1]` that specifies the alpha component of the desired blend color at the beginning of the fade operation. For more information, see [Display Fade Blend Fractions](/documentation/CoreGraphics/display-fade-blend-fractions).

`endBlend`

An intensity value in the interval `[0, 1]` that specifies the alpha component of the desired blend color at the end of the fade operation. For more information, see [Display Fade Blend Fractions](/documentation/CoreGraphics/display-fade-blend-fractions).

`redBlend`

An intensity value in the interval `[0, 1]` that specifies the red component of the desired blend color.

`greenBlend`

An intensity value in the interval `[0, 1]` that specifies the green component of the desired blend color.

`blueBlend`

An intensity value in the interval `[0, 1]` that specifies the blue component of the desired blend color.

`synchronous`

Pass `true` if you want the fade operation to be synchronous; otherwise, pass `false`. If a fade operation is synchronous, the function doesn’t return until the operation is complete.

## Return Value

A result code. To interpret the result code, see [`CGError`](/documentation/CoreGraphics/CGError).

## Discussion

Over the fade operation time interval, Quartz interpolates a blending coefficient between the starting and ending values given, applying a nonlinear (sine-based) bias term. Using this coefficient, Quartz blends the video output with the specified color.

The following example shows how to perform a 2-second synchronous fade-out to black:

```objc
CGDisplayFade (
    myToken,
    2.0,                        // 2 seconds
    kCGDisplayBlendNormal,      // starting state
    kCGDisplayBlendSolidColor,  // ending state
    0.0, 0.0, 0.0,              // black
    true                        // wait for completion
);
```

To perform a 2-second asynchronous fade-in from black:

```objc
CGDisplayFade (
    myToken,
    2.0,                        // 2 seconds
    kCGDisplayBlendSolidColor,  // starting state
    kCGDisplayBlendNormal,      // ending state
    0.0, 0.0, 0.0,              // black
    false                       // don't wait for completion
);
```

If you specify an asynchronous fade operation, it’s safe to call [`CGReleaseDisplayFadeReservation(_:)`](/documentation/CoreGraphics/CGReleaseDisplayFadeReservation(_:)) immediately after this function returns.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)