support more formatting
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m35s

This commit is contained in:
Lee 2024-04-16 20:58:03 +01:00
parent 924e045a18
commit b7b788847d

View File

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