Function: color-blend

color-blend is a byte-compiled function defined in compat-31.el.

Signature

(color-blend A B &optional ALPHA)

Documentation

[Compatibility function for color-blend, defined in Emacs 31.0.50. See
(compat) Emacs 31.0.50' for more details.]

Blend the two colors A and B in linear space with ALPHA. A and B should be lists (RED GREEN BLUE), where each element is between 0.0 and 1.0, inclusive. ALPHA controls the influence A has on the result and should be between 0.0 and
1.0, inclusive.

For instance:

   (color-blend '(1 0.5 1) '(0 0 0) 0.75) => (0.75 0.375 0.75)

Source Code

;; Defined in ~/.emacs.d/elpa/compat-31.0.0.2/compat-31.el
;;;; Defined in color.el

(compat-defun color-blend (a b &optional alpha) ;; <compat-tests:color-blend>
  "Blend the two colors A and B in linear space with ALPHA.
A and B should be lists (RED GREEN BLUE), where each element is
between 0.0 and 1.0, inclusive.  ALPHA controls the influence A
has on the result and should be between 0.0 and 1.0, inclusive.

For instance:

   (color-blend \\='(1 0.5 1) \\='(0 0 0) 0.75)
      => (0.75 0.375 0.75)"
  (setq alpha (or alpha 0.5))
  (let (blend)
    (dotimes (i 3)
      (push (+ (* (nth i a) alpha) (* (nth i b) (- 1 alpha))) blend))
    (nreverse blend)))