We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a71c641 commit 83e8167Copy full SHA for 83e8167
webapp/src/Utils/Utils.php
@@ -352,6 +352,12 @@ public static function convertToColor(string $hex): ?string
352
*/
353
public static function parseHexColor(string $hex): array
354
{
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
+ }
361
// Source: https://stackoverflow.com/a/21966100
362
$length = (strlen($hex) - 1) / 3;
363
$fact = [17, 1, 0.062272][$length - 1];
0 commit comments