Function: erc-nicks--get-contrast
erc-nicks--get-contrast is a byte-compiled function defined in
erc-nicks.el.gz.
Signature
(erc-nicks--get-contrast FG &optional BG)
Documentation
Return a float between 1 and 21 for colors FG and BG.
If FG or BG are floats, interpret them as luminance values.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-nicks.el.gz
(defun erc-nicks--get-contrast (fg &optional bg)
"Return a float between 1 and 21 for colors FG and BG.
If FG or BG are floats, interpret them as luminance values."
(let* ((lum-fg (if (numberp fg) fg (erc-nicks--get-luminance fg)))
(lum-bg (if bg
(if (numberp bg) bg (erc-nicks--get-luminance bg))
(or erc-nicks--bg-luminance
(setq erc-nicks--bg-luminance
(erc-nicks--get-luminance erc-nicks-bg-color))))))
(when (< lum-fg lum-bg) (cl-rotatef lum-fg lum-bg))
(/ (+ 0.05 lum-fg) (+ 0.05 lum-bg))))