Refactored the thresholdFunc to use an even more generic function: colorThresholdFunc which allows you to apply a predicate to a Color, allowing you to access the individual red, green and blue components to threshold on a specific color range.