You are here

public function SassColour::asHex in Sassy 7.3

File

phpsass/script/literals/SassColour.php, line 765

Class

SassColour
SassColour class. A SassScript object representing a CSS colour.

Code

public function asHex($inc_hash = TRUE) {
  $red = str_pad(dechex($this->red), 2, '0', STR_PAD_LEFT);
  $grn = str_pad(dechex($this->green), 2, '0', STR_PAD_LEFT);
  $blu = str_pad(dechex($this->blue), 2, '0', STR_PAD_LEFT);
  return ($inc_hash ? '#' : '') . $red . $grn . $blu;
}