Sha256: e9ed15da9a0d2cf207770ae96fd325f8191b85952978413a9f57dd8aa56ecdfb
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
module Ray class Color class << self def red; new(255, 0, 0); end def green; new(0, 255, 0); end def blue; new(0, 0, 255); end def black; new(0, 0,0); end def white; new(255, 255, 255); end def none; new(0, 0, 0, 0); end def gray; new(128, 128, 128); end def cyan; new(0, 255, 255); end def yellow; new(255, 255, 0); end def fuschia; new(255, 0, 255); end end def inspect "RGBA(#{r}, #{g}, #{b}, #{a})" end def ==(obj) return false unless obj.is_a? Color r == obj.r && g == obj.g && b == obj.b && a == obj.a end def to_color self end alias :red :r alias :green :g alias :blue :b alias :alpha :a alias :red= :r= alias :green= :g= alias :blue= :b= alias :alpha= :a= end end class Array # Converts an Array to a color def to_color Ray::Color.new(*self) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ray-0.0.1 | lib/ray/color.rb |