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)
A simple answer for rgb to hex
function rgbtohex(r,g,b){ return "#" + (Math.round(r) * 65536 + Math.round(g) * 256 + Math.round(b)).toString(16)); }