Function: color-xyz-to-oklab
color-xyz-to-oklab is a byte-compiled function defined in
compat-30.el.
Signature
(color-xyz-to-oklab X Y Z)
Documentation
[Compatibility function for color-xyz-to-oklab, defined in Emacs 30.1. See
(compat) Emacs 30.1' for more details.]
Convert the CIE XYZ color represented by X Y Z to Oklab.
Source Code
;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-30.el
(compat-defun color-xyz-to-oklab (x y z) ;; <compat-tests:color-xyz-to-oklab>
"Convert the CIE XYZ color represented by X Y Z to Oklab."
:feature color
(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))))))