From 024a8eebb56b8380f0b049987845eb161560aac2 Mon Sep 17 00:00:00 2001 From: Rian McGuire Date: Thu, 29 Aug 2024 20:48:40 +1000 Subject: [PATCH] Handle non-sRGB displays on macOS --- window/src/os/macos/window.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/window/src/os/macos/window.rs b/window/src/os/macos/window.rs index 7576e72b6..af0527f69 100644 --- a/window/src/os/macos/window.rs +++ b/window/src/os/macos/window.rs @@ -525,6 +525,10 @@ impl Window { window.setReleasedWhenClosed_(NO); window.setBackgroundColor_(cocoa::appkit::NSColor::clearColor(nil)); + // Tell Cocoa that we output in sRGB, so it handles color space + // conversion for non-sRGB displays. + window.setColorSpace_(cocoa::appkit::NSColorSpace::sRGBColorSpace(nil)); + // We could set this, but it makes the entire window, including // its titlebar, opaque to this fixed degree. // window.setAlphaValue_(0.4);