Skip to content

Commit b5fcf94

Browse files
committed
Reapply "Remove alpha from hexadecimal colors"
This reverts commit 7de6ec0.
1 parent 713f4a7 commit b5fcf94

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

webapp/src/Utils/Utils.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ public static function convertToColor(string $hex): ?string
352352
*/
353353
public static function parseHexColor(string $hex): array
354354
{
355+
// Ignore alpha in hexstrings
356+
if (strlen($hex) === 5) {
357+
$hex = substr($hex, 0, 4);
358+
} else if (strlen($hex) === 9) {
359+
$hex = substr($hex, 0, 7);
360+
}
355361
// Source: https://stackoverflow.com/a/21966100
356362
$length = (strlen($hex) - 1) / 3;
357363
$fact = [17, 1, 0.062272][$length - 1];

0 commit comments

Comments
 (0)