Sha256: 4cf41d2558e86d7360d133e1fa87b4418f0c7d816b49961bddd11f56fb2e03c6
Contents?: true
Size: 380 Bytes
Versions: 2
Compression:
Stored size: 380 Bytes
Contents
module RGBUtils class LumaCalculator < Calculator RED_L = 0.299 GREEN_L = 0.587 BLUE_L = 0.114 delegate :red, :green, :blue, to: :rgb def initialize(color) @rgb = HexToRGBConverter.convert(color) end def calculate @luma ||= ((RED_L * red) + (GREEN_L * green) + (BLUE_L * blue))/255 end private attr_reader :rgb end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rgb_utils-0.1.2 | lib/rgb_utils/calculators/luma_calculator.rb |
rgb_utils-0.1.1 | lib/rgb_utils/calculators/luma_calculator.rb |