Skip to content

Commit 89fab32

Browse files
Fix PR review feedback for OKLCH color format
- Force sRGB color space in OKLCH and LAB conversions so the linearization curve and matrices match the actual color space - Swap LAB/OpenGL labels in keyboard shortcut grid to match menu (Cmd+5=LAB, Cmd+6=OpenGL) - Guard LAB format handler against SwiftUI copy format - Fix "OpenGl" typo in background export line Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 37ad585 commit 89fab32

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

Pika/Extensions/Cula.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ extension NSColor {
321321
*/
322322

323323
private func toXYZComponents() -> (x: CGFloat, y: CGFloat, z: CGFloat) {
324-
let srgb = toRGBAComponents()
324+
let srgb = toRGBAComponents(in: .sRGB)
325325

326326
// Linearize sRGB components
327327
func linearize(_ c: CGFloat) -> CGFloat {
@@ -401,7 +401,7 @@ extension NSColor {
401401
*/
402402

403403
func toOklchComponents() -> (l: CGFloat, c: CGFloat, h: CGFloat) {
404-
let srgb = toRGBAComponents()
404+
let srgb = toRGBAComponents(in: .sRGB)
405405

406406
// Linearize sRGB components
407407
func linearize(_ c: CGFloat) -> CGFloat {

Pika/Utilities/Exporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Exporter {
2424
// swiftlint:disable line_length
2525
return """
2626
\(PikaText.textColorForeground): Hex \(foregroundHex) · RGB \(foregroundRgb) · HSB \(foregroundHsb) · HSL \(foregroundHsl) · OpenGL \(foregroundOpengl) · OKLCH \(foregroundOklch)
27-
\(PikaText.textColorBackground): Hex \(backgroundHex) · RGB \(backgroundRgb) · HSB \(backgroundHsb) · HSL \(backgroundHsl) · OpenGl \(backgroundOpengl) · OKLCH \(backgroundOklch)
27+
\(PikaText.textColorBackground): Hex \(backgroundHex) · RGB \(backgroundRgb) · HSB \(backgroundHsb) · HSL \(backgroundHsl) · OpenGL \(backgroundOpengl) · OKLCH \(backgroundOklch)
2828
\(PikaText.textColorRatio): \(colorContrastRatio):1
2929
\(PikaText.textColorWCAG): AA Large (\(colorWCAGCompliance.ratio30 ? passMessage : failMessage)) · AA / AAA Large (\(colorWCAGCompliance.ratio45 ? passMessage : failMessage)) · AAA (\(colorWCAGCompliance.ratio70 ? passMessage : failMessage)) · Non-text (\(colorWCAGCompliance.ratio30 ? passMessage : failMessage))
3030
"""

Pika/Views/EyedropperItem.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ struct EyedropperItem: View {
8484
.onReceive(NotificationCenter.default.publisher(
8585
for: Notification.Name(PikaConstants.ncTriggerFormatLAB)))
8686
{ _ in
87-
colorFormat = .lab
87+
if copyFormat != .swiftUI {
88+
colorFormat = .lab
89+
}
8890
}
8991
.onReceive(NotificationCenter.default.publisher(
9092
for: Notification.Name(PikaConstants.ncTriggerFormatOKLCH)))

Pika/Views/KeyboardShortcutGrid.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ struct KeyboardShortcutGrid: View {
176176
.frame(height: verticalUnit)
177177

178178
KeyboardShortcutItem(
179-
title: PikaText.textFormatOpenGL,
180-
event: PikaConstants.ncTriggerFormatOpenGL,
179+
title: PikaText.textFormatLAB,
180+
event: PikaConstants.ncTriggerFormatLAB,
181181
keys: ["", "5"]
182182
)
183183
.frame(width: horizontalUnit, height: verticalUnit)
@@ -186,8 +186,8 @@ struct KeyboardShortcutGrid: View {
186186
.frame(height: verticalUnit)
187187

188188
KeyboardShortcutItem(
189-
title: PikaText.textFormatLAB,
190-
event: PikaConstants.ncTriggerFormatLAB,
189+
title: PikaText.textFormatOpenGL,
190+
event: PikaConstants.ncTriggerFormatOpenGL,
191191
keys: ["", "6"]
192192
)
193193
.frame(width: horizontalUnit, height: verticalUnit)

0 commit comments

Comments
 (0)