You are here

public static function SassScriptFunctions::hsla in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/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 * @param SassNumber The saturation of the colour as a percentage. * Must be between 0% and 100% inclusive * @param SassNumber The lightness of the colour as a percentage. * Must be between 0% and 100% inclusive * @param float The alpha channel. A number between 0 and 1. * @return new SassColour The resulting colour * @throws SassScriptFunctionException if saturation, lightness or alpha are * out of bounds

1 call to SassScriptFunctions::hsla()
SassScriptFunctions::hsl in phamlp/sass/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

phamlp/sass/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,
  ));
}