Function: color-xyz-to-oklab

color-xyz-to-oklab is a byte-compiled function defined in color.el.gz.

Signature

(color-xyz-to-oklab X Y Z)

Documentation

Convert the CIE XYZ color represented by X Y Z to Oklab.

Source Code

;; Defined in /usr/src/emacs/lisp/color.el.gz
(defun color-xyz-to-oklab (x y z)
  "Convert the CIE XYZ color represented by X Y Z to Oklab."
  (let ((ll (+ (* x 0.8189330101) (* y 0.3618667424) (* z -0.1288597137)))
        (mm (+ (* x 0.0329845436) (* y 0.9293118715) (* z 0.0361456387)))
        (ss (+ (* x 0.0482003018) (* y 0.2643662691) (* z 0.6338517070))))
    (let*
        ((cube-root (lambda (f)
                      (if (< f 0)
                          (- (expt (- f) (/ 1.0 3.0)))
                        (expt f (/ 1.0 3.0)))))
         (lll (funcall cube-root ll))
         (mmm (funcall cube-root mm))
         (sss (funcall cube-root ss)))
      (list (+ (* lll 0.2104542553) (* mmm 0.7936177850) (* sss -0.0040720468))
            (+ (* lll 1.9779984951) (* mmm -2.4285922050) (* sss 0.4505937099))
            (+ (* lll 0.0259040371) (* mmm 0.7827717662) (* sss -0.8086757660))))))