argb = $pARGB; } /** * Get ARGB * * @return string */ public function getARGB() { return $this->argb; } /** * Set ARGB * * @param string $pValue * @return \PhpOffice\PhpPresentation\Style\Color */ public function setARGB($pValue = self::COLOR_BLACK) { if ($pValue == '') { $pValue = self::COLOR_BLACK; } $this->argb = $pValue; return $this; } /** * Get the alpha % of the ARGB * Will return 100 if no ARGB * @return integer */ public function getAlpha() { $alpha = 100; if (strlen($this->argb) >= 6) { $dec = hexdec(substr($this->argb, 0, 2)); $alpha = number_format(($dec/255) * 100, 2); } return $alpha; } /** * Set the alpha % of the ARGB * @param int $alpha * @return $this */ public function setAlpha($alpha = 100) { if ($alpha < 0) { $alpha = 0; } if ($alpha > 100) { $alpha = 100; } $alpha = round(($alpha / 100) * 255); $alpha = dechex($alpha); $alpha = str_pad($alpha, 2, '0', STR_PAD_LEFT); $this->argb = $alpha . substr($this->argb, 2); return $this; } /** * Get RGB * * @return string */ public function getRGB() { if (strlen($this->argb) == 6) { return $this->argb; } else { return substr($this->argb, 2); } } /** * Set RGB * * @param string $pValue * @param string $pAlpha * @return \PhpOffice\PhpPresentation\Style\Color */ public function setRGB($pValue = '000000', $pAlpha = 'FF') { if ($pValue == '') { $pValue = '000000'; } if ($pAlpha == '') { $pAlpha = 'FF'; } $this->argb = $pAlpha . $pValue; return $this; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5( $this->argb . __CLASS__ ); } /** * Get hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @return string Hash index */ public function getHashIndex() { return $this->hashIndex; } /** * Set hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @param string $value Hash index */ public function setHashIndex($value) { $this->hashIndex = $value; } }