summaryrefslogtreecommitdiff
path: root/lisp/color.el
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2011-02-01 23:46:27 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-02-01 23:46:27 +0000
commit39cde66c5e6c226586187fe13d91fd2c65eb4649 (patch)
tree664bb498045cbff062838dcb623c3062a6a5e5c0 /lisp/color.el
parente8e4d5c88e04390481b3156c0e5efe40979d8519 (diff)
downloademacs-39cde66c5e6c226586187fe13d91fd2c65eb4649.tar.gz
mm-uu.el (mm-uu-type-alist): Add support for git format-patch diff format.
mm-decode.el (mm-inline-media-tests): Do not check for diff-mode it's standard in Emacs nowadays. color.el (color-gradient): Add a color-gradient function.
Diffstat (limited to 'lisp/color.el')
-rw-r--r--lisp/color.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/color.el b/lisp/color.el
index 5c95fffbfad..3874e33bfbb 100644
--- a/lisp/color.el
+++ b/lisp/color.el
@@ -47,6 +47,20 @@ RED GREEN BLUE must be values between 0 and 1 inclusively."
(- 1.0 (cadr color))
(- 1.0 (caddr color)))))
+(defun color-gradient (start stop step-number)
+ "Return a list with STEP-NUMBER colors from START to STOP.
+The color list builds a color gradient starting at color START to
+color STOP. It does not include the START and STOP color in the
+resulting list."
+ (loop for i from 1 to step-number
+ with red-step = (/ (- (car stop) (car start)) (1+ step-number))
+ with green-step = (/ (- (cadr stop) (cadr start)) (1+ step-number))
+ with blue-step = (/ (- (caddr stop) (caddr start)) (1+ step-number))
+ collect (list
+ (+ (car start) (* i red-step))
+ (+ (cadr start) (* i green-step))
+ (+ (caddr start) (* i blue-step)))))
+
(defun color-complement-hex (color)
"Return the color that is the complement of COLOR, in hexadecimal format."
(apply 'color-rgb->hex (color-complement color)))