function rgb2hex(rgb) {
    return '#' + ('00000' + (rgb[0] << 16 | rgb[1] << 8 | rgb[2]).toString(16)).slice(-6).toUpperCase();
}
Convert [r, g, b] to #rrggbb.

@see https://gist.github.com/983535

@example
rgb2hex([255, 255, 255]) // '#ffffff'

@param {Array} rgb [r, g, b]
@return {String} #rrggbb

@author Jed Schmidt