Changed to use bitwise operators to perform the color conversion.