Method: Sass::Script::Value::Helpers#hsl_color

Defined in:
lib/sass/script/value/helpers.rb

#hsl_color(hue, saturation, lightness, alpha = nil) ⇒ Sass::Script::Value::Color

Construct a Sass Color from hsl values.

Parameters:

  • hue (::Number)

    The hue of the color in degrees. A non-negative number, usually less than 360.

  • saturation (::Number)

    The saturation of the color. Must be between 0 and 100 inclusive.

  • lightness (::Number)

    The lightness of the color. Must be between 0 and 100 inclusive.

  • alpha (::Number) (defaults to: nil)

    The alpha channel. A number between 0 and 1.

Returns:

Since:

  • 3.3.0



34
35
36
37
38
# File 'lib/sass/script/value/helpers.rb', line 34

def hsl_color(hue, saturation, lightness, alpha = nil)
  attrs = {:hue => hue, :saturation => saturation, :lightness => lightness}
  attrs[:alpha] = alpha if alpha
  Color.new(attrs)
end