Adding javascript code for converting into rgb and hex and rearranging all code.