client/splunk.ui.charting.js
function (color, elem, prop) {
		var colorObject,
			regexRgba = /^rgba/;
		if (color && color.linearGradient) {
			var renderer = this,
				strLinearGradient = 'linearGradient',
				linearGradient = color[strLinearGradient],
				id = PREFIX + idCounter++,
				gradientObject,
				stopColor,
				stopOpacity;
			gradientObject = renderer.createElement(strLinearGradient).attr({
				id: id,
				gradientUnits: 'userSpaceOnUse',
				x1: linearGradient[0],
				y1: linearGradient[1],
				x2: linearGradient[2],
				y2: linearGradient[3]
			}).add(renderer.defs);

			// Keep a reference to the gradient object so it is possible to destroy it later
			renderer.gradients.push(gradientObject);

			// The gradient needs to keep a list of stops to be able to destroy them
			gradientObject.stops = [];
			each(color.stops, function (stop) {
				var stopObject;
				if (regexRgba.test(stop[1])) {
					colorObject = Color(stop[1]);
					stopColor = colorObject.get('rgb');
					stopOpacity = colorObject.get('a');
				} else {
					stopColor = stop[1];
					stopOpacity = 1;
				}
				stopObject = renderer.createElement('stop').attr({
					offset: stop[0],
					'stop-color': stopColor,
					'stop-opacity': stopOpacity
				}).add(gradientObject);

				// Add the stop element to the gradient
				gradientObject.stops.push(stopObject);
			});

			return 'url(' + this.url + '#' + id + ')';

		// Webkit and Batik can't show rgba.
		} else if (regexRgba.test(color)) {
			colorObject = Color(color);
			attr(elem, prop + '-opacity', colorObject.get('a'));

			return colorObject.get('rgb');


		} else {
			// Remove the opacity attribute added above. Does not throw if the attribute is not there.
			elem.removeAttribute(prop + '-opacity');

			return color;
		}

	}
function (color, elem, prop) {
		var colorObject,
			regexRgba = /^rgba/;
		if (color && color.linearGradient) {
			var renderer = this,
				strLinearGradient = 'linearGradient',
				linearGradient = color[strLinearGradient],
				id = PREFIX + idCounter++,
				gradientObject,
				stopColor,
				stopOpacity;
			gradientObject = renderer.createElement(strLinearGradient).attr({
				id: id,
				gradientUnits: 'userSpaceOnUse',
				x1: linearGradient[0],
				y1: linearGradient[1],
				x2: linearGradient[2],
				y2: linearGradient[3]
			}).add(renderer.defs);

			// Keep a reference to the gradient object so it is possible to destroy it later
			renderer.gradients.push(gradientObject);

			// The gradient needs to keep a list of stops to be able to destroy them
			gradientObject.stops = [];
			each(color.stops, function (stop) {
				var stopObject;
				if (regexRgba.test(stop[1])) {
					colorObject = Color(stop[1]);
					stopColor = colorObject.get('rgb');
					stopOpacity = colorObject.get('a');
				} else {
					stopColor = stop[1];
					stopOpacity = 1;
				}
				stopObject = renderer.createElement('stop').attr({
					offset: stop[0],
					'stop-color': stopColor,
					'stop-opacity': stopOpacity
				}).add(gradientObject);

				// Add the stop element to the gradient
				gradientObject.stops.push(stopObject);
			});

			return 'url(' + this.url + '#' + id + ')';

		// Webkit and Batik can't show rgba.
		} else if (regexRgba.test(color)) {
			colorObject = Color(color);
			attr(elem, prop + '-opacity', colorObject.get('a'));

			return colorObject.get('rgb');


		} else {
			// Remove the opacity attribute added above. Does not throw if the attribute is not there.
			elem.removeAttribute(prop + '-opacity');

			return color;
		}

	}
function ( color , elem , prop ) { var colorObject , regexRgba = / ^rgba / ; if ( color && color . linearGradient ) { var renderer = this , strLinearGradient = 'linearGradient' , linearGradient = color [ strLinearGradient ] , id = PREFIX + idCounter ++ , gradientObject , stopColor , stopOpacity ; gradientObject = renderer . createElement ( strLinearGradient ) . attr ( { id : id , gradientUnits : 'userSpaceOnUse' , x1 : linearGradient [ 0 ] , y1 : linearGradient [ 1 ] , x2 : linearGradient [ 2 ] , y2 : linearGradient [ 3 ] } ) . add ( renderer . defs ) ; // Keep a reference to the gradient object so it is possible to destroy it later
 renderer . gradients . push ( gradientObject ) ; // The gradient needs to keep a list of stops to be able to destroy them
 gradientObject . stops = [ ] ; each ( color . stops , function ( stop ) { var stopObject ; if ( regexRgba . test ( stop [ 1 ] ) ) { colorObject = Color ( stop [ 1 ] ) ; stopColor = colorObject . get ( 'rgb' ) ; stopOpacity = colorObject . get ( 'a' ) ; } else { stopColor = stop [ 1 ] ; stopOpacity = 1 ; } stopObject = renderer . createElement ( 'stop' ) . attr ( { offset : stop [ 0 ] , 'stop-color' : stopColor , 'stop-opacity' : stopOpacity } ) . add ( gradientObject ) ; // Add the stop element to the gradient
 gradientObject . stops . push ( stopObject ) ; } ) ; return 'url(' + this . url + '#' + id + ')' ; // Webkit and Batik can't show rgba.
 } else if ( regexRgba . test ( color ) ) { colorObject = Color ( color ) ; attr ( elem , prop + '-opacity' , colorObject . get ( 'a' ) ) ; return colorObject . get ( 'rgb' ) ; } else { // Remove the opacity attribute added above. Does not throw if the attribute is not there.
 elem . removeAttribute ( prop + '-opacity' ) ; return color ; } }
Take a color and return it if it's a string, make it a gradient if it's a
gradient configuration object

@param {Object} color The color or config object
Take a color and return it if it s a string make it a gradient if it s a gradient configuration object