refactor: simplify color handling in ClassicConsoleBackend

- Removed hex color handling logic from ClassicConsoleBackend, streamlining the WriteLineFormatted method.
- Updated ColorHelper to ensure consistent formatting for color codes.
- Ensured console-specific settings are reapplied after backend initialization in Program.cs.
This commit is contained in:
BruceChen 2026-04-08 01:33:38 +08:00
parent 64c42bb4b5
commit ff00d01fd7
3 changed files with 9 additions and 23 deletions

View file

@ -202,6 +202,11 @@ namespace MinecraftClient
{
ConsoleIO.Backend = new ClassicConsoleBackend();
ConsoleIO.Backend.Init();
// Config deserialization triggers OnSettingUpdate before the backend
// exists, so console-specific settings (UseVT100ColorCode, colors, etc.)
// are never applied. Re-apply them now that the backend is ready.
Config.Console.OnSettingUpdate();
}
if (!ProcessStartupState(startupState))
@ -240,6 +245,7 @@ namespace MinecraftClient
ConsoleIO.Backend = new ClassicConsoleBackend();
ConsoleIO.Backend.Init();
Config.Console.OnSettingUpdate();
ConsoleIO.WriteLineFormatted("§c" + Translations.mcc_tui_startup_failed);
ConsoleIO.WriteLine(exception.ToString());