def to_hsl(color, include_alpha = false)
      hue, chroma, max, min = hue_and_chroma(color)
      lightness  = 0.5 * (max + min)
      saturation = chroma.zero? ? 0.0 : chroma.fdiv(1 - (2 * lightness - 1).abs)

      include_alpha ? [hue, saturation, lightness, a(color)] :
                      [hue, saturation, lightness]
    end
def to_hsl(color, include_alpha = false)
      hue, chroma, max, min = hue_and_chroma(color)
      lightness  = 0.5 * (max + min)
      saturation = chroma.zero? ? 0.0 : chroma.fdiv(1 - (2 * lightness - 1).abs)

      include_alpha ? [hue, saturation, lightness, a(color)] :
                      [hue, saturation, lightness]
    end
Returns an array with the separate HSL components of a color.

 Because ChunkyPNG internally handles colors as Integers for performance
 reasons, some rounding  occurs when importing or exporting HSL colors
 whose coordinates are float-based.  Because of this rounding, #to_hsl and
 #from_hsl may not be perfect inverses.

 This implementation follows the modern convention of 0 degrees hue indicating red.

 @param [Integer] color The ChunkyPNG color to convert.
 @param [Boolean] include_alpha Flag indicates whether a fourth element
     representing alpha channel should be included in the returned array.
 @return [Array<Fixnum>[0]] The hue of the color (0-360)
 @return [Array<Fixnum>[1]] The saturation of the color (0-1)
 @return [Array<Fixnum>[2]] The lightness of the color (0-1)
 @return [Array<Fixnum>[3]] Optional fourth element for alpha, included if
     include_alpha=true (0-255)
 @see http://en.wikipedia.org/wiki/HSL_and_HSV