Split getColorAt into separate functions