Simplify color conversion code