src/core/util/color.js
function rgbaToHex(color) {
    color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);

    var hex = (color && color.length === 4) ? "#" +
    ("0" + parseInt(color[1],10).toString(16)).slice(-2) +
    ("0" + parseInt(color[2],10).toString(16)).slice(-2) +
    ("0" + parseInt(color[3],10).toString(16)).slice(-2) : '';

    return hex.toUpperCase();
  }
function rgbaToHex(color) {
    color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);

    var hex = (color && color.length === 4) ? "#" +
    ("0" + parseInt(color[1],10).toString(16)).slice(-2) +
    ("0" + parseInt(color[2],10).toString(16)).slice(-2) +
    ("0" + parseInt(color[3],10).toString(16)).slice(-2) : '';

    return hex.toUpperCase();
  }
function rgbaToHex ( color ) { color = color . match ( / ^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]? / i ) ; var hex = ( color && color . length === 4 ) ? "#" + ( "0" + parseInt ( color [ 1 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( color [ 2 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) + ( "0" + parseInt ( color [ 3 ] , 10 ) . toString ( 16 ) ) . slice ( - 2 ) : '' ; return hex . toUpperCase ( ) ; }
Converts rgba value to hex string
@param {string} color
@returns {string}
Converts rgba value to hex string