vendor/gems/haml-2.2.2/lib/sass/script/functions.rb
def hsl(hue, saturation, lightness)
      original_s = saturation
      original_l = lightness
      # This algorithm is from http://www.w3.org/TR/css3-color#hsl-color
      h, s, l = [hue, saturation, lightness].map { |a| a.value }
      raise ArgumentError.new("Saturation #{s} must be between 0% and 100%") if s < 0 || s > 100
      raise ArgumentError.new("Lightness #{l} must be between 0% and 100%") if l < 0 || l > 100

      h = (h % 360) / 360.0
      s /= 100.0
      l /= 100.0

      m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s
      m1 = l * 2 - m2
      Color.new([hue_to_rgb(m1, m2, h + 1.0/3),
                 hue_to_rgb(m1, m2, h),
                 hue_to_rgb(m1, m2, h - 1.0/3)].map { |c| (c * 0xff).round })
    end
# Creates a {Color} object from hue, saturation, and lightness
# as per the CSS3 spec (http://www.w3.org/TR/css3-color/#hsl-color).
#
# @param hue [Number] The hue of the color.
#   Should be between 0 and 360 degrees, inclusive
# @param saturation [Number] The saturation of the color.
#   Must be between `0%` and `100%`, inclusive
# @param lightness [Number] The lightness of the color.
#   Must be between `0%` and `100%`, inclusive
# @return [Color] The resulting color
# @raise [ArgumentError] if `saturation` or `lightness` are out of bounds
Creates a {Color} object from hue, saturation, and lightness
as per the CSS3 spec .
Creates a { Color } object from hue saturation and lightness as per the CSS3 spec .
def hsl(hue, saturation, lightness)
      original_s = saturation
      original_l = lightness
      h, s, l = [hue, saturation, lightness].map { |a| a.value }
      raise ArgumentError.new("Saturation #{s} must be between 0% and 100%") if s < 0 || s > 100
      raise ArgumentError.new("Lightness #{l} must be between 0% and 100%") if l < 0 || l > 100
      h = (h % 360) / 360.0
      s /= 100.0
      l /= 100.0
      m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s
      m1 = l * 2 - m2
      Color.new([hue_to_rgb(m1, m2, h + 1.0/3),
                 hue_to_rgb(m1, m2, h),
                 hue_to_rgb(m1, m2, h - 1.0/3)].map { |c| (c * 0xff).round })
    end
def hsl ( hue , saturation , lightness ) original_s = saturation original_l = lightness h , s , l = [ hue , saturation , lightness ] . map { | a | a . value } raise ArgumentError . new ( "Saturation #{s} must be between 0% and 100%" ) if s < 0 || s > 100 raise ArgumentError . new ( "Lightness #{l} must be between 0% and 100%" ) if l < 0 || l > 100 h = ( h % 360 ) / 360.0 s /= 100.0 l /= 100.0 m2 = l <= 0.5 ? l * ( s + 1 ) : l + s - l * s m1 = l * 2 - m2 Color . new ( [ hue_to_rgb ( m1 , m2 , h + 1.0 / 3 ) , hue_to_rgb ( m1 , m2 , h ) , hue_to_rgb ( m1 , m2 , h - 1.0 / 3 ) ] . map { | c | ( c * 0xff ) . round } ) end
Creates a {Color} object from hue, saturation, and lightness
as per the CSS3 spec (http://www.w3.org/TR/css3-color/#hsl-color).
Creates a { Color } object from hue saturation and lightness as per the CSS3 spec ( http : // www . w3 . org / TR / css3 - color / #hsl - color ) .
# This algorithm is from http://www.w3.org/TR/css3-color#hsl-color
The resulting color
The resulting color
Color
[ArgumentError] if `saturation` or `lightness` are out of bounds
[ ArgumentError ] if ` saturation ` or ` lightness ` are out of bounds
hue
The hue of the color. Should be between 0 and 360 degrees, inclusive
The hue of the color . Should be between 0 and 360 degrees inclusive
saturation
The saturation of the color. Must be between `0%` and `100%`, inclusive
The saturation of the color . Must be between ` 0% ` and ` 100% ` inclusive
lightness
The lightness of the color. Must be between `0%` and `100%`, inclusive
The lightness of the color . Must be between ` 0% ` and ` 100% ` inclusive