public function asHex($inc_hash = TRUE) { return sprintf(($inc_hash ? '#' : '') . '%02x%02x%02x', str_replace(',', '.', round($this->red)), str_replace(',', '.', round($this->green)), str_replace(',', '.', round($this->blue))); }
/** * returns an IE hex string for a color with an alpha channel * suitable for passing to IE filters. */ public static function ie_hex_str($color) { if (!$color instanceof SassColour) { $color = new SassColour($color); } $alpha = str_replace(',', '.', round($color->alpha * 255)); $alpha_str = str_pad(dechex($alpha), 2, '0', STR_PAD_LEFT); $col = $color->asHex(FALSE); return new SassString(strtoupper('#' . $alpha_str . $col)); }