You are here

public static function SassScriptFunctions::alpha in Sassy 7.3

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

Returns the alpha component (opacity) of a colour.

Parameters

SassColour The colour:

Return value

new SassNumber The alpha component (opacity) of colour

Throws

SassScriptFunctionException If $colour is not a colour

RL modified so that the filter: alpha function doesn't bork

File

phpsass/script/SassScriptFunctions.php, line 239

Class

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

Code

public static function alpha($colour) {
  try {
    SassLiteral::assertType($colour, 'SassColour');
  } catch (Exception $e) {
    return new SassString('alpha(100)');
  }
  return new SassNumber($colour->alpha);
}