This commit is contained in:
Lee 2024-04-16 21:01:05 +01:00
parent b7b788847d
commit 37b048c2a9

@ -70,15 +70,15 @@ public final class ColorUtils {
}
for (char character : input.toCharArray()) {
// Found color symbol, next character is the color code
if (character == '§') {
if (character == '§') { // Found color symbol
nextIsColor = true;
builder.append(character); // Append the color symbol to the HTML
continue;
}
if (nextIsColor) { // Apply color formatting
// Map the current color to its hex code
String color = COLOR_MAP.getOrDefault(Character.toLowerCase(character), "");
// Check if the current character is a valid color code
if (!color.isEmpty()) {
builder.append("<span style=\"color:").append(color);
// Apply additional formatting if necessary
if (character == 'l') { // Make the char bold
@ -94,6 +94,7 @@ public final class ColorUtils {
builder.append(";text-decoration:line-through");
}
builder.append("\">");
}
nextIsColor = false; // Reset the flag
continue;
}