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.
This commit is contained in:
Yoshimasa Niwa
2024-12-31 19:23:25 +09:00
parent 60611b8a4a
commit eb3c9f9b52
3 changed files with 5 additions and 0 deletions

View File

@ -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:

View File

@ -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:

View File

@ -5291,6 +5291,7 @@ pub const WindowTheme = enum {
pub const WindowColorspace = enum {
srgb,
@"display-p3",
@"generic-rgb",
};
/// See macos-titlebar-style