Method: Color::HSL#mix_with

Defined in:
lib/color/hsl.rb

#mix_with(color, mix_percent = 0.5) ⇒ Object

Mix the mask colour (which will be converted to an HSL colour) with the current colour at the stated mix percentage as a decimal value.

NOTE

This differs from Color::RGB#mix_with.

[View source]

176
177
178
179
180
181
# File 'lib/color/hsl.rb', line 176

def mix_with(color, mix_percent = 0.5)
  v = to_a.zip(coerce(color).to_a).map { |(x, y)|
    ((y - x) * mix_percent) + x
  }
  self.class.from_fraction(*v)
end