2e3514ccacc941c9b8ffcaecb83438b4c3053e5e
Merge parents 4cbae69 a13fa51
kate
  Thu Oct 22 20:35:34 2015 -0700
Resolving merge

diff --cc src/lib/rainbow.c
index 5465b23,fdf5a3a..686dc03
--- src/lib/rainbow.c
+++ src/lib/rainbow.c
@@@ -175,21 -139,31 +175,38 @@@
  
  struct rgbColor lightRainbowAtPos(double pos)
  /* Given pos, a number between 0 and 1, return a lightish rainbow rgbColor
   * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
  {
  return interpolatedHue(lightRainbowTable, ArraySize(lightRainbowTable), pos);
  }
  
  struct rgbColor saturatedRainbowAtPos(double pos)
  /* Given pos, a number between 0 and 1, return a saturated rainbow rgbColor
   * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
  {
  return interpolatedHue(saturatedRainbowTable, ArraySize(saturatedRainbowTable), pos);
  }
  
 +struct rgbColor whiteToBlackRainbowAtPos(double pos)
 +/* Given pos, a number between 0 and 1, return a blackToWhite rainbow rgbColor
 + * where 0 maps to white,  0.1 is grey, and 1 is black. */
 +{
 +return interpolatedHue(whiteToBlackRainbowTable, ArraySize(whiteToBlackRainbowTable), pos);
 +}
++
+ struct rgbColor *getRainbow(struct rgbColor (*rainbowAtPos)(double pos), int size)
+ /* Return array filled with rainbow of colors */
+ {
+ struct rgbColor *colors;
+ AllocArray(colors, size);
+ double invCount = 1.0/size;
+ double pos;
+ int i;
+ for (i = 0; i < size; i++)
+     {
+     pos = invCount * i;
+     colors[i] = (*rainbowAtPos)(pos);
+     }
+ return colors;
+ }
+