updated color function