You are here

public static function SassScriptFunctions::hsla in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/script/SassScriptFunctions.php \SassScriptFunctions::hsla()

Creates a SassColour object from hue, saturation, lightness and alpha channel (opacity).

Parameters

SassNumber The hue of the colour in degrees.: Should be between 0 and 360 inclusive

SassNumber The saturation of the colour as a percentage.: Must be between 0% and 100% inclusive

SassNumber The lightness of the colour as a percentage.: Must be between 0% and 100% inclusive

float The alpha channel. A number between 0 and 1.:

Return value

new SassColour The resulting colour

Throws

SassScriptFunctionException if saturation, lightness or alpha are out of bounds

1 call to SassScriptFunctions::hsla()
SassScriptFunctions::hsl in phpsass/script/SassScriptFunctions.php
Creates a SassColour object from hue, saturation, and lightness. Uses the algorithm from the {@link http://www.w3.org/TR/css3-colour/#hsl-colour CSS3 spec}.

File

phpsass/script/SassScriptFunctions.php, line 150

Class

SassScriptFunctions
SassScript functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.script

Code

public static function hsla($h, $s, $l, $a) {
  SassLiteral::assertType($h, 'SassNumber');
  SassLiteral::assertType($s, 'SassNumber');
  SassLiteral::assertType($l, 'SassNumber');
  SassLiteral::assertType($a, 'SassNumber');
  SassLiteral::assertInRange($s, 0, 100, '%');
  SassLiteral::assertInRange($l, 0, 100, '%');
  SassLiteral::assertInRange($a, 0, 1);
  return new SassColour(array(
    'hue' => $h,
    'saturation' => $s,
    'lightness' => $l,
    'alpha' => $a,
  ));
}