HEX to RGB color converter by Nitin Kumar Output View Horizontal Vertical HTML CSS JS Tidy HEX to RGB color converter HEX Color "#e66465" HEX #e66465 to HTML CSS JS Tidy HTML CSS JS Tidy var getcolor = document.getElementById("head").value; console.log(getcolor); function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } document.getElementById("rgbValue").innerHTML = `RGB( ${hexToRgb(getcolor).r}, ${hexToRgb(getcolor).g}, ${hexToRgb(getcolor).b})`; >_Console Clear Console >_Console File Setting HTML Code Playground Setting Title Description HEX to RGB color converter in javascript Catagory Javascript Tags color Resource Add External Stylesheets and Script