/** * get hex codes for each stage * @param int $stageCount number of stages * @return array array of hex codes, one for each stage */ public function getWorkflowStageColors($stageCount, $getShaded = false) { $color1 = $this->colors['first']; $color2 = $this->colors['last']; $startingRgb = X2Color::hex2rgb2($color1); $endingRgb = X2Color::hex2rgb2($color2); $rgbDifference = array($endingRgb[0] - $startingRgb[0], $endingRgb[1] - $startingRgb[1], $endingRgb[2] - $startingRgb[2]); if ($stageCount === 1) { $rgbSteps = array(0, 0, 0); } else { $steps = $stageCount - 1; // 1 step for each stage other than the first $rgbSteps = array($rgbDifference[0] / $steps, $rgbDifference[1] / $steps, $rgbDifference[2] / $steps); } $colors = array(); for ($i = 0; $i < $stageCount; $i++) { $colors[] = X2Color::rgb2hex2($startingRgb[0] + $rgbSteps[0] * $i, $startingRgb[1] + $rgbSteps[1] * $i, $startingRgb[2] + $rgbSteps[2] * $i); if ($getShaded) { $colors[$i] = array($colors[$i]); $colors[$i][] = X2Color::rgb2hex2(array_map(function ($a) { return $a > 255 ? 255 : $a; }, array(0.93 * ($startingRgb[0] + $rgbSteps[0] * $i), 0.93 * ($startingRgb[1] + $rgbSteps[1] * $i), 0.93 * ($startingRgb[2] + $rgbSteps[2] * $i)))); } } return $colors; }