From eb3c9f9b525bda101dd955b777fd9852f562f538 Mon Sep 17 00:00:00 2001 From: Yoshimasa Niwa Date: Tue, 31 Dec 2024 19:23:25 +0900 Subject: [PATCH] Add `NSCalibratedRGBColorSpace` support. **Problems** Ghostty is using sRGB by default, optionally Display P3 color space. However neither color space matches to the color space that the regular macOS apps are using. That is `NSCalibratedRGBColorSpace`, seems called "Generic RGB" from initializer API name. Because of this, colors has same hex value are slightly darker on Ghostty compare to Terminal.app, for example. **Solution** Add `generic-rgb` to `WindowColorspace`, therefore users can set `window-colorspace` to `generic-rgb` in config to have similar colors with the other macOS apps. --- .../Features/QuickTerminal/QuickTerminalController.swift | 2 ++ macos/Sources/Features/Terminal/TerminalController.swift | 2 ++ src/config/Config.zig | 1 + 3 files changed, 5 insertions(+) diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift index 47ee2dfd9..1aeba2069 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift @@ -322,6 +322,8 @@ class QuickTerminalController: BaseTerminalController { switch (self.derivedConfig.windowColorspace) { case "display-p3": window.colorSpace = .displayP3 + case "generic-rgb": + window.colorSpace = .genericRGB case "srgb": fallthrough default: diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index c3b332cd4..73ac3409a 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -301,6 +301,8 @@ class TerminalController: BaseTerminalController { switch (config.windowColorspace) { case "display-p3": window.colorSpace = .displayP3 + case "generic-rgb": + window.colorSpace = .genericRGB case "srgb": fallthrough default: diff --git a/src/config/Config.zig b/src/config/Config.zig index 91c07cc78..d7679ccc1 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -5291,6 +5291,7 @@ pub const WindowTheme = enum { pub const WindowColorspace = enum { srgb, @"display-p3", + @"generic-rgb", }; /// See macos-titlebar-style