Skip to content

Conversions

Denis Kreshikhin edited this page Nov 16, 2026 · 2 revisions

Conversions

Coral sRGB (0.8, 0.3, 0.2), converted with converted(to:).

let color = Color<SRGB>(
    red: 0.8,
    green: 0.3,
    blue: 0.2
)
let oklab = color.converted(to: OKLab.self)
let oklch = color.converted(to: OKLCH.self)
let restored = oklch.converted(to: SRGB.self)

The last row is that OKLCH color converted back to sRGB. CIE76 from the original is 0.00.

Space Components
SRGB 0.8000, 0.3000, 0.2000
LinearSRGB 0.6038, 0.0732, 0.0331
XYZ 0.2812, 0.1832, 0.0519
Lab 50.5534, 50.5133, 42.3369
LCH 50.5534, 65.9091, 40.0°
OKLab 0.5866, 0.1399, 0.0915
OKLCH 0.5866, 0.1671, 33.2°
SRGB round trip 0.8000, 0.3000, 0.2000

Hue is degrees. A neutral color has no hue. Components are not clamped.

See also Interpolation, Contrast, Difference.

Clone this wiki locally