lib/resolver/gradient/linear.js
function(colorStop) {
			colorStop = normalizeSpace(colorStop);
			
			// find color declaration
			// first, try complex color declaration, like rgb(0,0,0)
			var color = null;
			colorStop = colorStop.replace(/^(\w+\(.+?\))\s*/, function(str, c) {
				color = c;
				return '';
			});
			
			if (!color) {
				// try simple declaration, like yellow, #fco, #ffffff, etc.
				var parts = colorStop.split(' ');
				color = parts[0];
				colorStop = parts[1] || '';
			}
			
			var result = {
				color: color
			};
			
			if (colorStop) {
				// there's position in color stop definition
				colorStop.replace(/^(\-?[\d\.]+)([a-z%]+)?$/, function(str, pos, unit) {
					result.position = pos;
					if (~pos.indexOf('.')) {
						unit = '';
					} else if (!unit) {
						unit = '%';
					}
					
					if (unit) {
						result.unit = unit;
					}
				});
			}
			
			return result;
		}
function(colorStop) {
			colorStop = normalizeSpace(colorStop);
			
			// find color declaration
			// first, try complex color declaration, like rgb(0,0,0)
			var color = null;
			colorStop = colorStop.replace(/^(\w+\(.+?\))\s*/, function(str, c) {
				color = c;
				return '';
			});
			
			if (!color) {
				// try simple declaration, like yellow, #fco, #ffffff, etc.
				var parts = colorStop.split(' ');
				color = parts[0];
				colorStop = parts[1] || '';
			}
			
			var result = {
				color: color
			};
			
			if (colorStop) {
				// there's position in color stop definition
				colorStop.replace(/^(\-?[\d\.]+)([a-z%]+)?$/, function(str, pos, unit) {
					result.position = pos;
					if (~pos.indexOf('.')) {
						unit = '';
					} else if (!unit) {
						unit = '%';
					}
					
					if (unit) {
						result.unit = unit;
					}
				});
			}
			
			return result;
		}
function ( colorStop ) { colorStop = normalizeSpace ( colorStop ) ; // find color declaration // first, try complex color declaration, like rgb(0,0,0) var color = null ; colorStop = colorStop . replace ( / ^(\w+\(.+?\))\s* / , function ( str , c ) { color = c ; return '' ; } ) ; if ( ! color ) { // try simple declaration, like yellow, #fco, #ffffff, etc. var parts = colorStop . split ( ' ' ) ; color = parts [ 0 ] ; colorStop = parts [ 1 ] || '' ; } var result = { color : color } ; if ( colorStop ) { // there's position in color stop definition colorStop . replace ( / ^(\-?[\d\.]+)([a-z%]+)?$ / , function ( str , pos , unit ) { result . position = pos ; if ( ~ pos . indexOf ( '.' ) ) { unit = '' ; } else if ( ! unit ) { unit = '%' ; } if ( unit ) { result . unit = unit ; } } ) ; } return result ; }
Parses color stop definition
@param {String} colorStop
@returns {Object}
Parses color stop definition