91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/g_spot_michael.rb', line 91
def find_color_variation (targetLuma, minLuma, maxLuma, targetSaturation, minSaturation, maxSaturation)
max = nil
maxValue = 0
@swatches.each do |swatch|
sat = swatch.hsl[1]
luma = swatch.hsl[2]
if !is_already_selected(swatch) && sat >= minSaturation && sat <= maxSaturation && luma >= minLuma && luma <= maxLuma
value = create_comparison_value sat, targetSaturation, luma, targetLuma, swatch.population, @HighestPopulation
if !max || value > maxValue
max = swatch
maxValue = value
end
end
end
max
end
|