# File lib/color/hsl.rb, line 57
57:   def to_rgb(ignored = nil)
58:       # If luminosity is zero, the colour is always black.
59:     return Color::RGB.new if @l == 0
60:       # If luminosity is one, the colour is always white.
61:     return Color::RGB.new(0xff, 0xff, 0xff) if @l == 1
62:       # If saturation is zero, the colour is always a greyscale colour.
63:     return Color::RGB.new(@l, @l, @l) if @s <= 1e-5
64: 
65:     if (@l - 0.5) < 1e-5
66:       tmp2 = @l * (1.0 + @s.to_f)
67:     else
68:       tmp2 = @l + @s - (@l * @s.to_f)
69:     end
70:     tmp1 = 2.0 * @l - tmp2
71: 
72:     t3  = [ @h + 1.0 / 3.0, @h, @h - 1.0 / 3.0 ]
73:     t3 = t3.map { |tmp3|
74:       tmp3 += 1.0 if tmp3 < 1e-5
75:       tmp3 -= 1.0 if (tmp3 - 1.0) > 1e-5
76:       tmp3
77:     }
78: 
79:     rgb = t3.map do |tmp3|
80:       if ((6.0 * tmp3) - 1.0) < 1e-5
81:         tmp1 + ((tmp2 - tmp1) * tmp3 * 6.0)
82:       elsif ((2.0 * tmp3) - 1.0) < 1e-5
83:         tmp2
84:       elsif ((3.0 * tmp3) - 2.0) < 1e-5
85:         tmp1 + (tmp2 - tmp1) * ((2 / 3.0) - tmp3) * 6.0
86:       else
87:         tmp1
88:       end
89:     end
90: 
91:      Color::RGB.from_fraction(*rgb)
92:   end