Function: color-hsl-to-rgb

color-hsl-to-rgb is a byte-compiled function defined in color.el.gz.

Signature

(color-hsl-to-rgb H S L)

Documentation

Convert hue, saturation and luminance to their RGB representation.

H, S, and L should each be numbers between 0.0 and 1.0, inclusive. Return a list (RED GREEN BLUE), where each element is between 0.0 and 1.0, inclusive.

Source Code

;; Defined in /usr/src/emacs/lisp/color.el.gz
(defun color-hsl-to-rgb (H S L)
  "Convert hue, saturation and luminance to their RGB representation.
H, S, and L should each be numbers between 0.0 and 1.0, inclusive.
Return a list (RED GREEN BLUE), where each element is between 0.0 and 1.0,
inclusive."
  (if (= S 0.0)
      (list L L L)
    (let* ((m2 (if (<= L 0.5)
		   (* L (+ 1.0 S))
		 (- (+ L S) (* L S))))
	   (m1 (- (* 2.0 L) m2)))
      (list
       (color-hue-to-rgb m1 m2 (mod (+ H (/ 3.0)) 1))
       (color-hue-to-rgb m1 m2 H)
       (color-hue-to-rgb m1 m2 (mod (- H (/ 3.0)) 1))))))