Last active
October 12, 2024 07:14
-
-
Save bobmagicii/f2d2c49f44ef50d8efe28bff6ec3222d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$GetValueCSS = (fn(?string $Input)=> match(TRUE) { | |
(str_starts_with($Input, '--')) | |
=> sprintf('var(%s)', $Input), | |
(!!preg_match('/^[0-9a-fA-F]{6,8}/', $Input)) | |
=> sprintf('#%s', $Input), | |
default | |
=> $Input | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment