From eb3c9f9b525bda101dd955b777fd9852f562f538 Mon Sep 17 00:00:00 2001 From: Yoshimasa Niwa Date: Tue, 31 Dec 2024 19:23:25 +0900 Subject: [PATCH 1/2] 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 47ee2dfd95..1aeba20692 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 c3b332cd40..73ac3409a0 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 91c07cc787..d7679ccc10 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 From ed5b6924f166e777c3025f49965c30256fc7eef7 Mon Sep 17 00:00:00 2001 From: Yoshimasa Niwa Date: Wed, 1 Jan 2025 00:57:11 +0900 Subject: [PATCH 2/2] Update config documentation. --- src/config/Config.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index d7679ccc10..b94fbf9d1b 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1067,7 +1067,8 @@ keybind: Keybinds = .{}, @"window-theme": WindowTheme = .auto, /// The colorspace to use for the terminal window. The default is `srgb` but -/// this can also be set to `display-p3` to use the Display P3 colorspace. +/// this can also be set to `display-p3` to use the Display P3 colorspace or +/// `generic-rgb` to use the Calibrated RGB colorspace. /// /// Changing this value at runtime will only affect new windows. ///