Added color extraction code