client/splunk.ui.charting.js
function(rgb){
            var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            var hex = (parts[1]<<16|parts[2]<<8|parts[3]).toString(16);
            return "#"+Array(6-hex.length).concat([hex]).toString().replace(/,/g, 0);
        }
function(rgb){
            var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
            var hex = (parts[1]<<16|parts[2]<<8|parts[3]).toString(16);
            return "#"+Array(6-hex.length).concat([hex]).toString().replace(/,/g, 0);
        }
function ( rgb ) { var parts = rgb . match ( / ^rgb\((\d+),\s*(\d+),\s*(\d+)\)$ / ) ; var hex = ( parts [ 1 ] << 16 | parts [ 2 ] << 8 | parts [ 3 ] ) . toString ( 16 ) ; return "#" + Array ( 6 - hex . length ) . concat ( [ hex ] ) . toString ( ) . replace ( / , / g , 0 ) ; }
Take an RGB value and convert to HEX equivalent.

@param {String} rgb A RGB value following rgb(XXX, XXX, XXX) convention.
@type String
@return A HEX equivalent for a given RGB value with a leading '#' character.
Take an RGB value and convert to HEX equivalent .