20 lines
374 B
PHP
20 lines
374 B
PHP
<?php
|
|
|
|
function randomColors(int $count, float $alpha = 0.2): array
|
|
{
|
|
$colors = [];
|
|
for ($i = 0; $i < $count; $i++) {
|
|
$r = rand(0, 255);
|
|
$g = rand(0, 255);
|
|
$b = rand(0, 255);
|
|
$colors[] = "rgba($r, $g, $b, $alpha)";
|
|
}
|
|
|
|
return $colors;
|
|
}
|
|
|
|
function randomBorderColors(int $count): array
|
|
{
|
|
return randomColors($count, 1.0);
|
|
}
|