Skip to content

Commit

Permalink
Merge pull request #39 from marc-farre/patch-1
Browse files Browse the repository at this point in the history
Update ColorHelper.php
  • Loading branch information
felixhahnweilheim authored Mar 1, 2024
2 parents 4e15fa7 + dac3eec commit be91fac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helpers/ColorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static function darken(string $color, int $amount, bool $relative = false
*/
public static function fade(string $color, int $amount): string
{
$opacity = ($amount / 100) * 255;
$opacity = round(($amount / 100) * 255);
$opacity = max(min($opacity, 255), 0); // keep between 0 and 255
$opacity = str_pad(dechex($opacity), 2, '0', STR_PAD_LEFT); // make 2 char hex code

Expand Down

0 comments on commit be91fac

Please sign in to comment.