docs: function colorgrad() {
      var args = Array.prototype.slice.call(arguments)
        , arraymath = require('./arraymath')
        , spec
        , cstep
        , c1 = args[0]
        , c2 = null
        , rgb1
        , rgb2
        , outType = isArray(c1) ? 'rgb': 'hex'
        , add = arraymath("+")
        , sub = arraymath("-")
        , div = arraymath("/")
        , mul = arraymath("*")
  
      /*
       *
       * Unpack specification object
       *
       */
      if(isObj(args[1])) {
        spec = args[1]
      }
      else if (isObj(args[2])) {
        spec = args[2]
        c2 = args[1]
      }
      else
        spec = {}
      /*
       * Or with defaults
       */
      var lum = spec.lum || 1
        , n = spec.nshades || 100
        , type = spec.type || "linear"
  
      /*
       *
       * Design the color step array which will be
       * a length 3 vector.
       *
       */
      rgb1 = isArray(c1) ? c1 : hex2rgb(c1)
      if(c2) // If two hexcolors supplied
        rgb2 = isArray(c2) ? c2 : hex2rgb(c2)
      else // 2nd color is lum% incr/decr of color1
        rgb2 = add( mul(rgb1,[lum]), rgb1)
  
      // Create step size to step through color gradient
      cstep = div( sub(rgb2, rgb1), [n-1])
  
      var i
        , nc = []
      nc[0] = rgb1
      for (i = 1; i < n; ++i) {
        nc[i] = add(nc[i-1], cstep)
      }
  
      function clims(c) {
        if(c > 255)
          return 255
        else if(c < 0)
          return 0
        else return c
      }
  
      var result = []
      nc.forEach(function (ar) {
        ar = ar.map(Math.round).map(clims)
        if(outType === 'hex')
          ar = rgb2hex(ar)
        result.push( ar )
      })
      return result
    }