Module: ColorMath::Blend

Extended by:
Blend
Included in:
Blend
Defined in:
lib/colormath/blend.rb

Overview

Blend two or more colours and return a new colour.

Instance Method Summary collapse

Instance Method Details

#alpha(ca, cb, alpha) ⇒ Object

Blend ca with cb. alpha represents the proportion of cb, i.e. alpha = 0 => ca; alpha = 1 => cb.



10
11
12
# File 'lib/colormath/blend.rb', line 10

def alpha(ca, cb, alpha)
  for_rgb(ca, cb){ |a, b| (alpha * b + (1 - alpha) * a) }
end