Skip to content

Commit 713f4a7

Browse files
committed
Reapply "Allow for both hexcolors with alpha as shorthand"
This reverts commit 02e5dd5.
1 parent 9508ead commit 713f4a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

webapp/src/Utils/Utils.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ public static function timeStringDiff(string $time1, string $time2): string
290290
*/
291291
public static function convertToHex(string $color): ?string
292292
{
293-
if (preg_match('/^#[[:xdigit:]]{3,6}$/', $color)) {
293+
if (preg_match('/^#[[:xdigit:]]{3,4}$/', $color) ||
294+
preg_match('/^#[[:xdigit:]]{6}$/', $color) ||
295+
preg_match('/^#[[:xdigit:]]{8}$/', $color)
296+
) {
294297
return $color;
295298
}
296299

0 commit comments

Comments
 (0)