Skip to content

Commit

Permalink
Fix rail signal color differences not displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny-Hui committed Dec 28, 2024
1 parent 08652f3 commit d9ce212
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/lx862/logregator/data/MTRLoggingManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,14 @@ public String tryGetFriendlyValue(String className, String fieldName, String raw
}

if(fieldName.equals("color")) {
int val = Integer.parseInt(value);
Color color = new Color(val);
try {
int val = Integer.parseInt(value);
Color color = new Color(val);

return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()).toUpperCase();
return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()).toUpperCase();
} catch (NumberFormatException e) { // Signal uses human-readable color name
return value;
}
}

if(fieldName.equals("acceleration_constant")) {
Expand Down

0 comments on commit d9ce212

Please sign in to comment.