flotr2.nolibs.js
function(color, options) {

    var opacity = options.opacity;
    if (!color) return 'rgba(0, 0, 0, 0)';
    if (color instanceof Color) return color.alpha(opacity).toString();
    if (_.isString(color)) return Color.parse(color).alpha(opacity).toString();
    
    var grad = color.colors ? color : {colors: color};
    
    if (!options.ctx) {
      if (!_.isArray(grad.colors)) return 'rgba(0, 0, 0, 0)';
      return Color.parse(_.isArray(grad.colors[0]) ? grad.colors[0][1] : grad.colors[0]).alpha(opacity).toString();
    }
    grad = _.extend({start: 'top', end: 'bottom'}, grad); 
    
    if (/top/i.test(grad.start))  options.x1 = 0;
    if (/left/i.test(grad.start)) options.y1 = 0;
    if (/bottom/i.test(grad.end)) options.x2 = 0;
    if (/right/i.test(grad.end))  options.y2 = 0;

    var i, c, stop, gradient = options.ctx.createLinearGradient(options.x1, options.y1, options.x2, options.y2);
    for (i = 0; i < grad.colors.length; i++) {
      c = grad.colors[i];
      if (_.isArray(c)) {
        stop = c[0];
        c = c[1];
      }
      else stop = i / (grad.colors.length-1);
      gradient.addColorStop(stop, Color.parse(c).alpha(opacity));
    }
    return gradient;
  }
function(color, options) {

    var opacity = options.opacity;
    if (!color) return 'rgba(0, 0, 0, 0)';
    if (color instanceof Color) return color.alpha(opacity).toString();
    if (_.isString(color)) return Color.parse(color).alpha(opacity).toString();
    
    var grad = color.colors ? color : {colors: color};
    
    if (!options.ctx) {
      if (!_.isArray(grad.colors)) return 'rgba(0, 0, 0, 0)';
      return Color.parse(_.isArray(grad.colors[0]) ? grad.colors[0][1] : grad.colors[0]).alpha(opacity).toString();
    }
    grad = _.extend({start: 'top', end: 'bottom'}, grad); 
    
    if (/top/i.test(grad.start))  options.x1 = 0;
    if (/left/i.test(grad.start)) options.y1 = 0;
    if (/bottom/i.test(grad.end)) options.x2 = 0;
    if (/right/i.test(grad.end))  options.y2 = 0;

    var i, c, stop, gradient = options.ctx.createLinearGradient(options.x1, options.y1, options.x2, options.y2);
    for (i = 0; i < grad.colors.length; i++) {
      c = grad.colors[i];
      if (_.isArray(c)) {
        stop = c[0];
        c = c[1];
      }
      else stop = i / (grad.colors.length-1);
      gradient.addColorStop(stop, Color.parse(c).alpha(opacity));
    }
    return gradient;
  }
function ( color , options ) { var opacity = options . opacity ; if ( ! color ) return 'rgba(0, 0, 0, 0)' ; if ( color instanceof Color ) return color . alpha ( opacity ) . toString ( ) ; if ( _ . isString ( color ) ) return Color . parse ( color ) . alpha ( opacity ) . toString ( ) ; var grad = color . colors ? color : { colors : color } ; if ( ! options . ctx ) { if ( ! _ . isArray ( grad . colors ) ) return 'rgba(0, 0, 0, 0)' ; return Color . parse ( _ . isArray ( grad . colors [ 0 ] ) ? grad . colors [ 0 ] [ 1 ] : grad . colors [ 0 ] ) . alpha ( opacity ) . toString ( ) ; } grad = _ . extend ( { start : 'top' , end : 'bottom' } , grad ) ; if ( / top / i . test ( grad . start ) ) options . x1 = 0 ; if ( / left / i . test ( grad . start ) ) options . y1 = 0 ; if ( / bottom / i . test ( grad . end ) ) options . x2 = 0 ; if ( / right / i . test ( grad . end ) ) options . y2 = 0 ; var i , c , stop , gradient = options . ctx . createLinearGradient ( options . x1 , options . y1 , options . x2 , options . y2 ) ; for ( i = 0 ; i < grad . colors . length ; i ++ ) { c = grad . colors [ i ] ; if ( _ . isArray ( c ) ) { stop = c [ 0 ] ; c = c [ 1 ] ; } else stop = i / ( grad . colors . length - 1 ) ; gradient . addColorStop ( stop , Color . parse ( c ) . alpha ( opacity ) ) ; } return gradient ; }
Process color and options into color style.
Process color and options into color style .