aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadeleaan <70163122+Madeleaan@users.noreply.github.com>2024-05-11 14:46:40 +0200
committerGitHub <noreply@github.com>2024-05-11 14:46:40 +0200
commitb07483e302a0bf056016302e2a3dcefc0e78c761 (patch)
treeeaec72e9f829b64e112bedc0e2780db0d6798f61
parent07d02cc3baf41689538ec0207a660f1aa95444e1 (diff)
downloadNotEnoughUpdates-b07483e302a0bf056016302e2a3dcefc0e78c761.tar.gz
NotEnoughUpdates-b07483e302a0bf056016302e2a3dcefc0e78c761.tar.bz2
NotEnoughUpdates-b07483e302a0bf056016302e2a3dcefc0e78c761.zip
Fix outline color of custom tooltips with formatting (#1158)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 14a5072b..1e785f58 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -1668,13 +1668,15 @@ public class Utils {
public static char getPrimaryColourCode(String displayName) {
int lastColourCode = -99;
int currentColour = 0;
+ int colourIndex = 0;
int[] mostCommon = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int i = 0; i < displayName.length(); i++) {
char c = displayName.charAt(i);
if (c == '\u00A7') {
lastColourCode = i;
} else if (lastColourCode == i - 1) {
- currentColour = Math.max(0, "0123456789abcdef".indexOf(c));
+ colourIndex = "0123456789abcdef".indexOf(c);
+ if (colourIndex != -1) currentColour = colourIndex;
} else if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(c) >= 0) {
if (currentColour > 0) {
mostCommon[currentColour]++;