How to convert colors in RGB format to hex format and vice versa?
For example, convert \'#0080C0\' to (0, 128, 192).
\'#0080C0\'
(0, 128, 192)
This code accept #fff and #ffffff variants and opacity.
function hex2rgb(hex, opacity) { var h=hex.replace('#', ''); h = h.match(new RegExp('(.{'+h.length/3+'})', 'g')); for(var i=0; i