Skip to content

Commit 8b45108

Browse files
committed
Fix second function
We now also read the alpha channel when needed.
1 parent 5f3ee00 commit 8b45108

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

webapp/src/Utils/Utils.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,11 @@ public static function componentToHex(int $component): string
375375
*/
376376
public static function rgbToHex(array $color): string
377377
{
378-
return "#" . static::componentToHex($color[0]) . static::componentToHex($color[1]) . static::componentToHex($color[2]);
378+
$result = "#";
379+
for (int $i=0; $i<count($color); $i++) {
380+
$result += static::componentToHex($color[$i]);
381+
}
382+
return $result;
379383
}
380384

381385
public static function relativeLuminance(string $rgb): float

0 commit comments

Comments
 (0)