lib/chroma/converters/rgb_converter.rb in chroma-0.0.1.alpha.1 vs lib/chroma/converters/rgb_converter.rb in chroma-0.0.1.alpha.2

- old
+ new

@@ -1,8 +1,12 @@ module Chroma module Converters class RgbConverter < Base + def convert_rgb + @input + end + def convert_hsl h, s, l = @input h = bound01(h, 360) s = bound01(s, 100) @@ -16,11 +20,11 @@ r = hue_to_rgb(p, q, h + 1/3.0) * 255 g = hue_to_rgb(p, q, h) * 255 b = hue_to_rgb(p, q, h - 1/3.0) * 255 end - ColorModes::Rgb.new(r, g, b) + ColorModes::Rgb.new(r, g, b, bound_alpha(@input.a)) end def convert_hsv h, s, v = @input @@ -37,10 +41,10 @@ r = [v, q, p, p, t, v][mod] * 255 g = [t, v, v, q, p, p][mod] * 255 b = [p, p, t, v, v, q][mod] * 255 - ColorModes::Rgb.new(r, g, b) + ColorModes::Rgb.new(r, g, b, bound_alpha(@input.a)) end private def hue_to_rgb(p, q, t)