diff --git a/packages/skia/apple/MetalWindowContext.mm b/packages/skia/apple/MetalWindowContext.mm index 72303071eb..8f8b597903 100644 --- a/packages/skia/apple/MetalWindowContext.mm +++ b/packages/skia/apple/MetalWindowContext.mm @@ -23,6 +23,15 @@ _layer.pixelFormat = MTLPixelFormatBGRA8Unorm; _layer.contentsGravity = kCAGravityBottomLeft; _layer.drawableSize = CGSizeMake(width, height); + BOOL supportsWideColor = NO; + if (@available(iOS 10.0, *)) { + supportsWideColor = [UIScreen mainScreen].traitCollection.displayGamut == UIDisplayGamutP3; + } + if (supportsWideColor) { + CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceDisplayP3); + _layer.colorspace = colorSpace; + CGColorSpaceRelease(colorSpace); + } } sk_sp MetalWindowContext::getSurface() { @@ -61,4 +70,4 @@ [commandBuffer presentDrawable:_currentDrawable]; [commandBuffer commit]; _skSurface = nullptr; -} +} \ No newline at end of file