fix: restore full color depth for hex color codes (§#RRGGBB)

After the dialog system PR (#3143), ResolveHexColors in ClassicConsoleBackend
mapped every §#RRGGBB hex color to the nearest of 16 standard Minecraft colors
via NearestMcColor. This meant all server-sent hex colors were downgraded to
4-bit ANSI regardless of the user's ConsoleColorMode setting.

Replaced the nearest-color lookup with ColorHelper.GetColorEscapeCode, which
generates the right output for each mode: 24-bit ANSI in vt100_24bit mode, 8-bit
in vt100_8bit, 4-bit in vt100_4bit, ConsoleColor in legacy_4bit.

Fixes #3146.
This commit is contained in:
Anon 2026-06-17 11:04:06 +02:00
parent 31876d485a
commit 73377685b4

View file

@ -64,7 +64,7 @@ namespace MinecraftClient
byte r = (byte)((HexVal(hex[0]) << 4) | HexVal(hex[1]));
byte g = (byte)((HexVal(hex[2]) << 4) | HexVal(hex[3]));
byte b = (byte)((HexVal(hex[4]) << 4) | HexVal(hex[5]));
return $"§{NearestMcColor(r, g, b)}";
return ColorHelper.GetColorEscapeCode(r, g, b, foreground: true);
});
}