Created
August 27, 2017 19:28
-
-
Save inxomnyaa/16b43c45978b41a9ad717144256ec9d8 to your computer and use it in GitHub Desktop.
Transforms a TextFormat constant to Color for example for coloring armor
This file contains hidden or 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
$colorconstant = TextFormat::RED; | |
list($r, $g, $b) = str_split(ltrim(str_replace('>', '', str_replace('<span style=color:#', '', TextFormat::toHTML(colorconstant))), '#')); | |
$color = new Color(...array_map('hexdec', [$r . $r, $g . $g, $b . $b])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment