Sha256: b1e5714e24245af6886db0612f5ccba0905664b5557a486db076dcdbc03ca2c7
Contents?: true
Size: 339 Bytes
Versions: 2
Compression:
Stored size: 339 Bytes
Contents
class Palat::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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
palat-0.1.1 | lib/palat/fake_rgba.rb |
palat-0.1.0 | lib/palat/fake_rgba.rb |