Example #1
0
        public static bool TryParse(char code, out ChatColor color)
        {
            color = code switch
            {
                '0' => Black,
                '1' => DarkBlue,
                '2' => DarkGreen,
                '3' => DarkCyan,
                '4' => DarkRed,
                '5' => Purple,
                '6' => Gold,
                '7' => Gray,
                '8' => DarkGray,
                '9' => Blue,
                'a' => BrightGreen,
                'b' => Cyan,
                'c' => Red,
                'd' => Pink,
                'e' => Yellow,
                'f' => White,
                'k' => Obfuscated,
                'l' => Bold,
                'm' => Strikethrough,
                'n' => Underline,
                'o' => Italic,
                'r' => Reset,
                _ => default
            };

            return(color.Code != default);
        }
Example #2
0
 public HexColor(ChatColor color) : this(color.Color)
 {
 }