feat(helper): membuat helpers untuk warna

This commit is contained in:
Yoga Pangestu 2025-11-11 15:35:29 +07:00
parent 11f6b70438
commit 4db29ba622
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,19 @@
<?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);
}

View File

@ -49,7 +49,8 @@
},
"files": [
"app/Helpers/DateTimeHelpers.php",
"app/Helpers/StringHelpers.php"
"app/Helpers/StringHelpers.php",
"app/Helpers/ColorHelpers.php"
]
},
"autoload-dev": {