@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | return [ |
| 113 | - 'r' => (int)hexdec(substr($color, 0, 2)), |
|
| 114 | - 'g' => (int)hexdec(substr($color, 2, 2)), |
|
| 115 | - 'b' => (int)hexdec(substr($color, 4, 2)), |
|
| 113 | + 'r' => (int) hexdec(substr($color, 0, 2)), |
|
| 114 | + 'g' => (int) hexdec(substr($color, 2, 2)), |
|
| 115 | + 'b' => (int) hexdec(substr($color, 4, 2)), |
|
| 116 | 116 | ]; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | // If saturation is 0, the given color is grey and only |
| 173 | 173 | // lightness is relevant. |
| 174 | 174 | if ($saturation == 0) { |
| 175 | - $lightness = (int)ceil($lightness * 255); |
|
| 175 | + $lightness = (int) ceil($lightness * 255); |
|
| 176 | 176 | |
| 177 | 177 | return ['r' => $lightness, 'g' => $lightness, 'b' => $lightness]; |
| 178 | 178 | } |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | $blue = self::hueToRgb($p, $q, $hue - 1 / 3); |
| 193 | 193 | |
| 194 | 194 | return [ |
| 195 | - 'r' => (int)round($red * 255, 2), |
|
| 196 | - 'g' => (int)round(round($green, 2) * 255), |
|
| 197 | - 'b' => (int)round($blue * 255, 2), |
|
| 195 | + 'r' => (int) round($red * 255, 2), |
|
| 196 | + 'g' => (int) round(round($green, 2) * 255), |
|
| 197 | + 'b' => (int) round($blue * 255, 2), |
|
| 198 | 198 | ]; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | { |
| 287 | 287 | $color2 = $color->getRgb(); |
| 288 | 288 | |
| 289 | - return (int)abs($this->colors['r'] - $color2['r']) |
|
| 290 | - + (int)abs($this->colors['g'] - $color2['g']) |
|
| 291 | - + (int)abs($this->colors['b'] - $color2['b']); |
|
| 289 | + return (int) abs($this->colors['r'] - $color2['r']) |
|
| 290 | + + (int) abs($this->colors['g'] - $color2['g']) |
|
| 291 | + + (int) abs($this->colors['b'] - $color2['b']); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | $mixWeight = $steps - $weight; |
| 342 | 342 | |
| 343 | 343 | $mixedColor = [ |
| 344 | - 'r' => (int)ceil((($this->getRgb()['r'] * $weight) + ($color->getRgb()['r'] * $mixWeight)) / $steps), |
|
| 345 | - 'g' => (int)ceil((($this->getRgb()['g'] * $weight) + ($color->getRgb()['g'] * $mixWeight)) / $steps), |
|
| 346 | - 'b' => (int)ceil((($this->getRgb()['b'] * $weight) + ($color->getRgb()['b'] * $mixWeight)) / $steps), |
|
| 344 | + 'r' => (int) ceil((($this->getRgb()['r'] * $weight) + ($color->getRgb()['r'] * $mixWeight)) / $steps), |
|
| 345 | + 'g' => (int) ceil((($this->getRgb()['g'] * $weight) + ($color->getRgb()['g'] * $mixWeight)) / $steps), |
|
| 346 | + 'b' => (int) ceil((($this->getRgb()['b'] * $weight) + ($color->getRgb()['b'] * $mixWeight)) / $steps), |
|
| 347 | 347 | ]; |
| 348 | 348 | |
| 349 | 349 | return new self(...array_values($mixedColor)); |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | public function lighten(float $percentage): Color |
| 476 | 476 | { |
| 477 | - $colors = $this->getHsl(); |
|
| 477 | + $colors = $this->getHsl(); |
|
| 478 | 478 | $colors['l'] += $colors['l'] * ($percentage / 100); |
| 479 | 479 | |
| 480 | 480 | $lighterColor = self::hslToRgb($colors['h'], $colors['s'], min(round($colors['l'], 5), 1)); |