Function: svg-gradient

svg-gradient is a byte-compiled function defined in svg.el.gz.

Signature

(svg-gradient SVG ID TYPE STOPS)

Documentation

Add a gradient with ID to SVG.

TYPE is linear or radial. STOPS is a list of percentage/color pairs.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/svg.el.gz
(defun svg-gradient (svg id type stops)
  "Add a gradient with ID to SVG.
TYPE is `linear' or `radial'.
STOPS is a list of percentage/color pairs."
  (svg--def
   svg
   (apply
    #'dom-node
    (if (eq type 'linear)
	'linearGradient
      'radialGradient)
    `((id . ,id)
      (x1 . 0)
      (x2 . 0)
      (y1 . 0)
      (y2 . 1))
    (mapcar
     (lambda (stop)
       (dom-node 'stop `((offset . ,(format "%s%%" (car stop)))
			 (stop-color . ,(cdr stop)))))
     stops))))