Add basic error checking to color conversion