Oklab

data class Oklab(L: Double, a: Double, b: Double) : Lab

A color in the Oklab uniform color space, which represents colors in dev.kdrag0n.colorkt.ucs.lab.Lab form. This color space is designed for overall uniformity and does not assume viewing conditions.

Note that this implementation uses a white point of D65, like sRGB. Linear sRGB is used as the intermediate color space.

See also

Constructors

Oklab
Link copied to clipboard
fun Oklab(L: Double, a: Double, b: Double)

Types

Companion
Link copied to clipboard
object Companion

Functions

toLinearSrgb
Link copied to clipboard
fun toLinearSrgb(): LinearSrgb

Convert this color to the linear sRGB color space.

toXyz
Link copied to clipboard
fun toXyz(): CieXyz

Convert this color to the CIE XYZ color space.

Properties

a
Link copied to clipboard
open override val a: Double

Green/red color component.

b
Link copied to clipboard
open override val b: Double

Blue/yellow color component.

L
Link copied to clipboard
open override val L: Double

Perceived lightness component.

Extensions

clipToLinearSrgb
Link copied to clipboard
fun Oklab.clipToLinearSrgb(method: OklabGamut.ClipMethod = ClipMethod.PRESERVE_LIGHTNESS, alpha: Double = 0.05): LinearSrgb

Convert this Oklab color to linear sRGB, and clip it to sRGB gamut boundaries if it's not already within gamut.

toOklch
Link copied to clipboard
@JvmName(name = "fromOklab")
fun Oklab.toOklch(): Oklch

Convert this color to the polar (LCh) representation of Oklab.