Skip to content

Commit

Permalink
fix non-relative lighten()
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhahnweilheim committed Feb 8, 2024
1 parent 064c7d7 commit 9b4be25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helpers/ColorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function lighten(string $color, int $amount, bool $relative = fals
$max = hexdec(max($color_parts));
$min = hexdec(min($color_parts));
if ($max !=0) {
$percentage = 2 * 255 * $percentage / ( $max + $min );
$percentage = $percentage / ( 1 - ($max + $min)/(2*255));
}
}

Expand Down Expand Up @@ -88,8 +88,8 @@ public static function fade(string $color, int $amount): string {
return $color . $opacity;
}

protected static function getColorComponents(string $color): array {
protected static function getColorComponents(string $color): array
{
// Remove leading '#'
$hexstr = ltrim($color, '#');
// if color has just 3 digits
Expand Down

0 comments on commit 9b4be25

Please sign in to comment.