feat(helper): membuat helpers untuk warna
This commit is contained in:
parent
11f6b70438
commit
4db29ba622
19
app/Helpers/ColorHelpers.php
Normal file
19
app/Helpers/ColorHelpers.php
Normal 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);
|
||||
}
|
||||
@ -49,7 +49,8 @@
|
||||
},
|
||||
"files": [
|
||||
"app/Helpers/DateTimeHelpers.php",
|
||||
"app/Helpers/StringHelpers.php"
|
||||
"app/Helpers/StringHelpers.php",
|
||||
"app/Helpers/ColorHelpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user