Function: tty-color-off-gray-diag

tty-color-off-gray-diag is a byte-compiled function defined in tty-colors.el.gz.

Signature

(tty-color-off-gray-diag R G B)

Documentation

Compute the angle between the color given by R,G,B and the gray diagonal.

The gray diagonal is the diagonal of the 3D cube in RGB space which connects the points corresponding to the black and white colors. All the colors whose RGB coordinates belong to this diagonal are various shades of gray, thus the name.

Source Code

;; Defined in /usr/src/emacs/lisp/term/tty-colors.el.gz
(defun tty-color-off-gray-diag (r g b)
  "Compute the angle between the color given by R,G,B and the gray diagonal.
The gray diagonal is the diagonal of the 3D cube in RGB space which
connects the points corresponding to the black and white colors.  All the
colors whose RGB coordinates belong to this diagonal are various shades
of gray, thus the name."
  (let ((mag (sqrt (* 3 (+ (* r r) (* g g) (* b b))))))
    (if (< mag 1) 0 (acos (/ (+ r g b) mag)))))