Method: ColorExtract::ColorUtil#dither

Defined in:
lib/color_extract/color_util.rb

#dither(color) ⇒ Object



91
92
93
94
95
96
97
98
99
100
# File 'lib/color_extract/color_util.rb', line 91

def dither( color )
  color.to_hsl.tap do |c|
    if c.s > 0.8
      c.s -= (c.s) * 0.3
      c.l -= 0.1
    else
      c.s += (1-c.s) * 0.5
    end
  end
end