Function: erc-nicks--get-luminance
erc-nicks--get-luminance is a byte-compiled function defined in
erc-nicks.el.gz.
Signature
(erc-nicks--get-luminance COLOR)
Documentation
Return relative luminance of COLOR.
COLOR can be a list of normalized values or a name. This is the
same as the Y component returned by color-srgb-to-xyz.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-nicks.el.gz
;; https://stackoverflow.com/questions/596216#answer-56678483
(defun erc-nicks--get-luminance (color)
"Return relative luminance of COLOR.
COLOR can be a list of normalized values or a name. This is the
same as the Y component returned by `color-srgb-to-xyz'."
(let ((out 0)
(coefficients '(0.2126 0.7152 0.0722))
(chnls (if (stringp color) (color-name-to-rgb color) color)))
(dolist (ch chnls out)
(cl-incf out (* (pop coefficients)
(if (<= ch 0.04045)
(/ ch 12.92)
(expt (/ (+ ch 0.055) 1.055) 2.4)))))))