13
0
geforkt von Mirrors/Paper

Handle legacy quirk in the console formatter (#8434)

Dieser Commit ist enthalten in:
Lulu13022002 2022-11-28 14:41:29 +01:00
Ursprung 2402c125aa
Commit 08bcef4859

Datei anzeigen

@ -117,6 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private static final String LOOKUP = "0123456789abcdefklmnor";
+
+ private static final String RGB_ANSI = "\u001B[38;2;%d;%d;%dm";
+ private static final String RESET_RGB_ANSI = ANSI_RESET + RGB_ANSI;
+ private static final Pattern NAMED_PATTERN = Pattern.compile(COLOR_CHAR + "[0-9a-fk-orA-FK-OR]");
+ private static final Pattern RGB_PATTERN = Pattern.compile(COLOR_CHAR + "#([0-9a-fA-F]){6}");
+
@ -145,22 +146,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ANSI_RESET, // Reset §r
+ };
+ private static final String[] ANSI_ANSI_CODES = new String[]{
+ "\u001B[0;30m", // Black §0
+ "\u001B[0;34m", // Dark Blue §1
+ "\u001B[0;32m", // Dark Green §2
+ "\u001B[0;36m", // Dark Aqua §3
+ "\u001B[0;31m", // Dark Red §4
+ "\u001B[0;35m", // Dark Purple §5
+ "\u001B[0;33m", // Gold §6
+ "\u001B[0;37m", // Gray §7
+ "\u001B[0;30;1m", // Dark Gray §8
+ "\u001B[0;34;1m", // Blue §9
+ "\u001B[0;32;1m", // Green §a
+ "\u001B[0;36;1m", // Aqua §b
+ "\u001B[0;31;1m", // Red §c
+ "\u001B[0;35;1m", // Light Purple §d
+ "\u001B[0;33;1m", // Yellow §e
+ "\u001B[0;37;1m", // White §f
+ ANSI_RESET + "\u001B[0;30m", // Black §0
+ ANSI_RESET + "\u001B[0;34m", // Dark Blue §1
+ ANSI_RESET + "\u001B[0;32m", // Dark Green §2
+ ANSI_RESET + "\u001B[0;36m", // Dark Aqua §3
+ ANSI_RESET + "\u001B[0;31m", // Dark Red §4
+ ANSI_RESET + "\u001B[0;35m", // Dark Purple §5
+ ANSI_RESET + "\u001B[0;33m", // Gold §6
+ ANSI_RESET + "\u001B[0;37m", // Gray §7
+ ANSI_RESET + "\u001B[0;30;1m", // Dark Gray §8
+ ANSI_RESET + "\u001B[0;34;1m", // Blue §9
+ ANSI_RESET + "\u001B[0;32;1m", // Green §a
+ ANSI_RESET + "\u001B[0;36;1m", // Aqua §b
+ ANSI_RESET + "\u001B[0;31;1m", // Red §c
+ ANSI_RESET + "\u001B[0;35;1m", // Light Purple §d
+ ANSI_RESET + "\u001B[0;33;1m", // Yellow §e
+ ANSI_RESET + "\u001B[0;37;1m", // White §f
+ "\u001B[5m", // Obfuscated §k
+ "\u001B[1m", // Bold §l
+ "\u001B[9m", // Strikethrough §m
@ -218,7 +219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final int red = color >> 16 & 0xFF;
+ final int green = color >> 8 & 0xFF;
+ final int blue = color & 0xFF;
+ return String.format(RGB_ANSI, red, green, blue);
+ return String.format(RESET_RGB_ANSI, red, green, blue);
+ }
+
+ private static String stripRGBColors(final String input) {