From 9b6fb6edef41fd3c9c111f197a677e22b3ac7d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20G=2E=20J=C3=B8rgensen?= Date: Mon, 22 Jun 2020 21:52:01 +0200 Subject: [PATCH] Always add a CSS class for obfuscated This makes it possible to style obfuscated without having to use CSS classes for all color/format codes. --- src/MinecraftColors.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MinecraftColors.php b/src/MinecraftColors.php index ce19b2a..bda12b0 100644 --- a/src/MinecraftColors.php +++ b/src/MinecraftColors.php @@ -151,8 +151,12 @@ static public function convertToHTML($text, $line_break_element = false, $css_cl $open_tags++; } - else if ($color_code === 'k') - $html = ''; + //Special case for obfuscated, always add a CSS class for this. + else if ($color_code === 'k') { + $css_classname = $css_prefix.self::$css_classnames[$color_code]; + $html .= sprintf(self::START_TAG_WITH_CLASS, $css_classname); + $open_tags++; + } else if (!$is_reset) { $html .= sprintf(self::START_TAG_INLINE_STYLED, self::$formatting[$color_code]);