function rgbToHex(rgbColor) {
    if (rgbColor[0] == '#' && rgbColor.length == 7) {
      // Color already in hex format.
      return rgbColor;
    }
    var digits = rgbColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
    var r = ('0' + parseInt(digits[1], 10).toString(16)).slice(-2);
    var g = ('0' + parseInt(digits[2], 10).toString(16)).slice(-2);
    var b = ('0' + parseInt(digits[3], 10).toString(16)).slice(-2);
    return '#' + r + g + b;
  }
/**
   * Converts rgb color format to hex. Color selector only takes hex for value.
   * @param {string} rgbColor
   * @return {string}
   */
Converts rgb color format to hex. Color selector only takes hex for value.
@param {string} rgbColor
@return {string}
Converts rgb color format to hex . Color selector only takes hex for value . @param { string } rgbColor @return { string }
function rgbToHex(rgbColor) {
    if (rgbColor[0] == '#' && rgbColor.length == 7) {
      return rgbColor;
    }
    var digits = rgbColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
    var r = ('0' + parseInt(digits[1], 10).toString(16)).slice(-2);
    var g = ('0' + parseInt(digits[2], 10).toString(16)).slice(-2);
    var b = ('0' + parseInt(digits[3], 10).toString(16)).slice(-2);
    return '#' + r + g + b;
  }
function rgbToHex ( rgbColor ) { if ( rgbColor [ 0 ] == '#' && rgbColor . length == 7 ) { return rgbColor ; } var digits = rgbColor . match ( / ^rgb\((\d+),\s*(\d+),\s*(\d+)\)$ / ) ; var r = ( '0' + parseInt ( digits [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) ; var g = ( '0' + parseInt ( digits [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) ; var b = ( '0' + parseInt ( digits [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) ; return '#' + r + g + b ; }
Converts rgb color format to hex.
Converts rgb color format to hex .
// Color already in hex format.