[gnus git] branch master updated: =1= color: add color-gradient function

Julien Danjou <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  e732e1f325f1252e50501024bcafdc6a1867aeeb (commit)
      from  27c9bb623a334776804d7b2a00a035844421fb97 (commit)


- Log -----------------------------------------------------------------
commit e732e1f325f1252e50501024bcafdc6a1867aeeb
Author: Julien Danjou <[email protected]>
Date:   Tue Feb 1 16:34:25 2011 +0100

    color: add color-gradient function
    
    Signed-off-by: Julien Danjou <[email protected]>

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 414175e..10c658e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-01  Julien Danjou  <[email protected]>
+
+	* color.el (color-gradient): Add a color-gradient function.
+
 2011-02-01  Lars Ingebrigtsen  <[email protected]>
 
 	* shr.el (shr-render-td): Only do colours at the final rendering.
diff --git a/lisp/color.el b/lisp/color.el
index 5c95fff..3874e33 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)))

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    4 ++++
 lisp/color.el  |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.