final color processing and algorithm