title: Detecting if a display supports 30-bit Color
body: <p>Apple recently enabled 30-bit color support on OS X. They’ve posted some <a href="https://developer.apple.com/library/mac/samplecode/DeepImageDisplayWithOpenGL/Introduction/Intro.html#//apple_ref/doc/uid/TP40016622" rel="nofollow">sample code</a> that shows how to enable this. However, they don’t seem to provide an example for how you can detect when your app is running on a display that supports 30-bit color.</p>
  
  <p>We’d like to be able to detect when the display(s) support 30-bit color and only enable 30-bit color for displays that support it and revert to 24-bit color otherwise.</p>
  
  <p>Does anyone know how to do that?</p>
  
  <p>So far I’ve tried using the <code>CGDisplay</code> APIs (<code>CGDisplayCopyDisplayMode</code> and <code>CGDisplayModeCopyPixelEncoding</code>) to query the display’s pixel encoding. But these seem to always return 24-bit encodings and <code>CGDisplayModeCopyPixelEncoding</code> was deprecated in Mac OS X 10.11. I’ve also tried using <code>NSScreen’s</code> “depth” property, but this also returns 24-bits per pixel. </p>
  
  <p>The built-in System Information app is obviously able to get at this information, I just can’t figure out how they’re doing it. Any hints?</p>