public function PdfTemplate::convertHexColorToArray in Views PDF 7.3
Same name and namespace in other branches
- 6 views_pdf_template.php \PdfTemplate::convertHexColorToArray()
- 7 views_pdf_template.php \PdfTemplate::convertHexColorToArray()
- 7.2 views_pdf_template.php \PdfTemplate::convertHexColorToArray()
Converts a hex color into an array with RGB colors.
1 call to PdfTemplate::convertHexColorToArray()
- PdfTemplate::parseColor in ./
views_pdf_template.php - Parse color input into an array.
File
- ./
views_pdf_template.php, line 218 - PDF Class to generate PDFs with native PHP. This class based on FPDF and FPDI.
Class
- PdfTemplate
- The main class to generate the PDF.
Code
public function convertHexColorToArray($hex) {
if (drupal_strlen($hex) == 6) {
$r = drupal_substr($hex, 0, 2);
$g = drupal_substr($hex, 2, 2);
$b = drupal_substr($hex, 4, 2);
return array(
hexdec($r),
hexdec($g),
hexdec($b),
);
}
elseif (drupal_strlen($hex) == 3) {
$r = drupal_substr($hex, 0, 1);
$g = drupal_substr($hex, 1, 1);
$b = drupal_substr($hex, 2, 1);
return array(
hexdec($r),
hexdec($g),
hexdec($b),
);
}
else {
return array();
}
}