<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -192,7 +192,7 @@ module Colorist
     
     # Returns an array of the hue, saturation and value of the color.
     # Hue will range from 0-359, hue and saturation will be between 0 and 1.
-    
+
     def to_hsv
       red, green, blue = *[r, g, b].collect {|x| x / 255.0}
       max = [red, green, blue].max
@@ -249,6 +249,28 @@ module Colorist
     def invert
       Color.from_rgb(255 - r, 255 - g, 255 - b)
     end
+        
+    # Uses a naive formula to generate a gradient between this color and the given color.
+    # Returns the array of colors that make the gradient, including this color and the
+    # target color.  By default will return 10 colors, but this can be changed by supplying
+    # an optional steps parameter.
+    def gradient_to(color, steps = 10)
+      color_to = Colorist::Color.from(color)
+      red = color_to.r - r
+      green = color_to.g - g
+      blue = color_to.b - b
+            
+      result = (1..(steps - 3)).to_a.collect do |step|
+        percentage = step.to_f / (steps - 1)
+        Color.from_rgb(r + (red * percentage), g + (green * percentage), b + (blue * percentage))
+      end
+      
+      # Add first and last colors to result, avoiding uneccessary calculation and rounding errors
+      
+      result.unshift(self.dup)
+      result.push(color.dup)
+      result
+    end
     
     # Converts the current color to grayscale using the brightness
     # formula provided. See #brightness for a description of the </diff>
      <filename>lib/colorist/color.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>09662bc95a038cfab6c7a13b534774121d5183ab</id>
    </parent>
  </parents>
  <author>
    <name>Tom Ward</name>
    <email>tom@popdog.net</email>
  </author>
  <url>http://github.com/mbleigh/colorist/commit/f991bbb41bff8d9726e3f3c3c2bd600cb1917312</url>
  <id>f991bbb41bff8d9726e3f3c3c2bd600cb1917312</id>
  <committed-date>2008-11-18T03:20:09-08:00</committed-date>
  <authored-date>2008-11-18T03:20:09-08:00</authored-date>
  <message>Added gradient_to method, that generates a gradient between the current color and a given color</message>
  <tree>89629a6c645d77ae71288e6711a19b20b8f76d1b</tree>
  <committer>
    <name>Tom Ward</name>
    <email>tom@popdog.net</email>
  </committer>
</commit>
