Extended with algorithm to detect colors