Add function for converting strings to color codes
This commit is contained in:
parent
287fb02f8c
commit
34c2d57e5b
14
MD_STD.php
14
MD_STD.php
|
@ -465,4 +465,18 @@ final class MD_STD {
|
||||||
return \levenshtein($str1, $str2);
|
return \levenshtein($str1, $str2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a string to color codes.
|
||||||
|
*
|
||||||
|
* @param string $str Input string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function string_to_color_code(string $str):string {
|
||||||
|
|
||||||
|
$code = substr(dechex(crc32($str)), 0, 6);
|
||||||
|
return $code;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user