<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/Depth",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@E@NSWindowDepth"
  },
  "title" : "NSWindow.Depth"
}
-->

# NSWindow.Depth

A type that represents the depth, or amount of memory, for a single pixel in a window or screen.

```
enum Depth
```

## Overview

A depth of `0` indicates default depth. Don’t make window depths persistent because they aren’t the same across systems.

Use the functions [`colorSpaceName`](/documentation/AppKit/NSWindow/Depth/colorSpaceName), [`bitsPerPixel`](/documentation/AppKit/NSWindow/Depth/bitsPerPixel), and [`isPlanar`](/documentation/AppKit/NSWindow/Depth/isPlanar) to extract info from an `NSWindowDepth` value.

Use [`NSBestDepth`](/documentation/AppKit/NSBestDepth) to compute window depths. [`NSBestDepth`](/documentation/AppKit/NSBestDepth) tries to accommodate all the parameters (match or better). If there are multiple matches, this function uses color space first, then bits per sample (`bps`), then `planar`, then bits per pixel (`bpp)` to determine the closest match. Use `0` for `bpp` to indicate the default, the same as the number of bits per plane: either `bps` or `bps` * [`numberOfColorComponents`](/documentation/AppKit/NSColorSpaceName/numberOfColorComponents). You may use other values as hints to provide backing stores of different configurations — for instance, 8-bit color.

You can also use one of the explicit bit depths defined in `Explicit Window Depth Limits` for the `NSWindow` property [`depthLimit`](/documentation/AppKit/NSWindow/depthLimit).

## Topics

### Constants

[`case onehundredtwentyeightBitRGB`](/documentation/AppKit/NSWindow/Depth/onehundredtwentyeightBitRGB)

One hundred and twenty eight bit RGB depth limit.

[`case sixtyfourBitRGB`](/documentation/AppKit/NSWindow/Depth/sixtyfourBitRGB)

Sixty four bit RGB depth limit.

[`case twentyfourBitRGB`](/documentation/AppKit/NSWindow/Depth/twentyfourBitRGB)

Twenty four bit RGB depth limit.

### Accessing Depth Details

[`static var availableDepths: [NSWindow.Depth]`](/documentation/AppKit/NSWindow/Depth/availableDepths)

An array that contains all available windows depths.

[`static func bestDepth(colorSpaceName: NSColorSpaceName, bitsPerSample: Int, bitsPerPixel: Int, isPlanar: Bool) -> (NSWindow.Depth, isExactMatch: Bool)`](/documentation/AppKit/NSWindow/Depth/bestDepth(colorSpaceName:bitsPerSample:bitsPerPixel:isPlanar:))

Determines the best window depth that most closely matches the given properties.

[`var bitsPerPixel: Int`](/documentation/AppKit/NSWindow/Depth/bitsPerPixel)

Returns the bits per pixel for the specified window depth.

[`var bitsPerSample: Int`](/documentation/AppKit/NSWindow/Depth/bitsPerSample)

Returns the bits per sample for the specified window depth.

[`var colorSpaceName: NSColorSpaceName?`](/documentation/AppKit/NSWindow/Depth/colorSpaceName)

Returns the name of the color space corresponding to the passed window depth.

[`var isPlanar: Bool`](/documentation/AppKit/NSWindow/Depth/isPlanar)

Returns whether the specified window depth is planar.

### Initializers

[`init?(rawValue: Int32)`](/documentation/AppKit/NSWindow/Depth/init(rawValue:))

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

---

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)