mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: usingColorSpace is only available with AppKit
This commit is contained in:
@ -12,7 +12,11 @@ extension OSColor {
|
||||
var a: CGFloat = 0
|
||||
|
||||
// getRed:green:blue:alpha requires sRGB space
|
||||
#if canImport(AppKit)
|
||||
guard let rgb = self.usingColorSpace(.sRGB) else { return 0 }
|
||||
#else
|
||||
let rgb = self
|
||||
#endif
|
||||
rgb.getRed(&r, green: &g, blue: &b, alpha: &a)
|
||||
return (0.299 * r) + (0.587 * g) + (0.114 * b)
|
||||
}
|
||||
|
Reference in New Issue
Block a user