Sha256: 44429e8a79595a11056f4daba0f1540c3ec84193a93ec77762561037992d6360
Contents?: true
Size: 548 Bytes
Versions: 1
Compression:
Stored size: 548 Bytes
Contents
module RGBUtils class RGB include Virtus.model attribute :red, Color attribute :green, Color attribute :blue, Color alias_attribute :r, :red alias_attribute :g, :green alias_attribute :b, :blue def as_unit_range [red, green, blue].map { |color| color / 255.0 } end def to_hex RGBToHexConverter.convert(self) end def contrast_color(type = :simple) return SimpleContrastColorResolver.for(self) if type == :simple ComplexContrastColorResolver.for(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rgb_utils-0.1.2 | lib/rgb_utils/models/rgb.rb |