Node.js examples for CSS:Color
Convert HEX codes to RGB values (#000000 -> rgb(0,0,0))
/*//from ww w .j a v a 2 s .com * Convert HEX codes to RGB values (#000000 -> rgb(0,0,0)) */ var hexToRgb = function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? parseInt(result[1], 16) + ', ' + parseInt(result[2], 16) + ', ' + parseInt(result[3], 16) : null; };