function rgbToHex (r, g, b) {
    function componentToHex (c) {
      var hex = c.toString(16)
      return hex.length === 1 ? '0' + hex : hex
    }
    return '#' + componentToHex(r) + componentToHex(g) + componentToHex(b)
  }
// RGB to hex conversion and add any required zero padding.
RGB to hex conversion and add any required zero padding.
RGB to hex conversion and add any required zero padding .
function rgbToHex (r, g, b) {
    function componentToHex (c) {
      var hex = c.toString(16)
      return hex.length === 1 ? '0' + hex : hex
    }
    return '#' + componentToHex(r) + componentToHex(g) + componentToHex(b)
  }
function rgbToHex ( r , g , b ) { function componentToHex ( c ) { var hex = c . toString ( 16 ) return hex . length === 1 ? '0' + hex : hex } return '#' + componentToHex ( r ) + componentToHex ( g ) + componentToHex ( b ) }
RGB to hex conversion and add any required zero padding.
RGB to hex conversion and add any required zero padding .