lib/rgb_utils/models/rgb.rb in rgb_utils-0.1.1 vs lib/rgb_utils/models/rgb.rb in rgb_utils-0.1.2
- old
+ new
@@ -4,9 +4,13 @@
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