Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
38 | 3 | protected static function getEvenlyDistributedColors(int $hue, int $numberOfColors): array |
|
39 | { |
||
40 | 3 | $saturationStepSize = 1/$numberOfColors; |
|
41 | 3 | $saturationStart = $saturationStepSize/2; |
|
42 | |||
43 | 3 | $colors = []; |
|
44 | |||
45 | 3 | for ($i = 0; $i<$numberOfColors; $i++) { |
|
46 | 3 | $saturation = ($saturationStart + ($i * $saturationStepSize)); |
|
47 | |||
48 | 3 | $hsv = new HsvColor($hue, $saturation, self::HSV_VALUE); |
|
49 | |||
50 | 3 | $colors[] = $hsv->toRgb(); |
|
51 | } |
||
52 | |||
53 | 3 | return $colors; |
|
54 | } |
||
56 |