Sha256: 5431fac85eee3b9bd21e1a9d8acfc82dae12195b59d04f3a875ff5e203c8eb78
Contents?: true
Size: 344 Bytes
Versions: 4
Compression:
Stored size: 344 Bytes
Contents
class Dvl::Color::FakeRgba def self.calculate(background, foreground, alpha) bg = background.rgb fg = foreground.rgb r = (fg.r * alpha) + (bg.r * (1 - alpha)) g = (fg.g * alpha) + (bg.g * (1 - alpha)) b = (fg.b * alpha) + (bg.b * (1 - alpha)) Chroma::Color.new(Chroma::ColorModes::Rgb.new(r, g, b), :hex) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dvl-color-0.0.4 | lib/dvl/color/fake_rgba.rb |
dvl-color-0.0.3 | lib/dvl/color/fake_rgba.rb |
dvl-color-0.0.2 | lib/dvl/color/fake_rgba.rb |
dvl-color-0.0.1 | lib/dvl/color/fake_rgba.rb |