added methods for converting rgb to hex and setting attributes of DOM elements