本文整理汇总了PHP中PHPExcel_Style_Color::indexedColors方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style_Color::indexedColors方法的具体用法?PHP PHPExcel_Style_Color::indexedColors怎么用?PHP PHPExcel_Style_Color::indexedColors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Style_Color
的用法示例。
在下文中一共展示了PHPExcel_Style_Color::indexedColors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexedColor
/**
* Get indexed color
*
* @param int $pIndex Index entry point into the colour array
* @param boolean $background Flag to indicate whether default background or foreground colour
* should be returned if the indexed colour doesn't exist
* @return PHPExcel_Style_Color
*/
public static function indexedColor($pIndex, $background = false)
{
// Clean parameter
$pIndex = intval($pIndex);
// Indexed colors
if (is_null(self::$indexedColors)) {
self::$indexedColors = array(1 => 'FF000000', 2 => 'FFFFFFFF', 3 => 'FFFF0000', 4 => 'FF00FF00', 5 => 'FF0000FF', 6 => 'FFFFFF00', 7 => 'FFFF00FF', 8 => 'FF00FFFF', 9 => 'FF800000', 10 => 'FF008000', 11 => 'FF000080', 12 => 'FF808000', 13 => 'FF800080', 14 => 'FF008080', 15 => 'FFC0C0C0', 16 => 'FF808080', 17 => 'FF9999FF', 18 => 'FF993366', 19 => 'FFFFFFCC', 20 => 'FFCCFFFF', 21 => 'FF660066', 22 => 'FFFF8080', 23 => 'FF0066CC', 24 => 'FFCCCCFF', 25 => 'FF000080', 26 => 'FFFF00FF', 27 => 'FFFFFF00', 28 => 'FF00FFFF', 29 => 'FF800080', 30 => 'FF800000', 31 => 'FF008080', 32 => 'FF0000FF', 33 => 'FF00CCFF', 34 => 'FFCCFFFF', 35 => 'FFCCFFCC', 36 => 'FFFFFF99', 37 => 'FF99CCFF', 38 => 'FFFF99CC', 39 => 'FFCC99FF', 40 => 'FFFFCC99', 41 => 'FF3366FF', 42 => 'FF33CCCC', 43 => 'FF99CC00', 44 => 'FFFFCC00', 45 => 'FFFF9900', 46 => 'FFFF6600', 47 => 'FF666699', 48 => 'FF969696', 49 => 'FF003366', 50 => 'FF339966', 51 => 'FF003300', 52 => 'FF333300', 53 => 'FF993300', 54 => 'FF993366', 55 => 'FF333399', 56 => 'FF333333');
}
if (array_key_exists($pIndex, self::$indexedColors)) {
return new PHPExcel_Style_Color(self::$indexedColors[$pIndex]);
}
if ($background) {
return new PHPExcel_Style_Color(self::COLOR_WHITE);
}
return new PHPExcel_Style_Color(self::COLOR_BLACK);
}