function rgb2hex(rgb) {
	return '#' + ['r', 'g', 'b'].map(function (key) {
		return ('0' + rgb[key].toString(16)).slice(-2);
	}).join('');
}
Converts an RGB color value to a hex string.
@param  Object rgb RGB as r, g, and b keys
@return String     Hex color string