function rgb2hex(sRGB) { let str = '#' var temp sRGB.slice(4, -1).split(',').forEach((value) => { temp = parseInt(value.trim()).toString(16) str += temp.length == 1 ? '0' + temp : temp }) if (str === '#NaN') return sRGB return str }
function rgb2hex(sRGB) { let str = '#' var temp sRGB.slice(4, -1).split(',').forEach((value) => { temp = parseInt(value.trim()).toString(16) str += temp.length == 1 ? '0' + temp : temp }) if (str === '#NaN') return sRGB return str }