From 1368bf08ef10506b64aed14616ae046d169190d1 Mon Sep 17 00:00:00 2001 From: "axel.gto" Date: Tue, 9 Jul 2024 16:14:30 +0200 Subject: [PATCH] Clear previous background color for win32 console before setting new one --- include/spdlog/sinks/wincolor_sink-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/sinks/wincolor_sink-inl.h b/include/spdlog/sinks/wincolor_sink-inl.h index 696db566..d5ae43ce 100644 --- a/include/spdlog/sinks/wincolor_sink-inl.h +++ b/include/spdlog/sinks/wincolor_sink-inl.h @@ -121,7 +121,7 @@ wincolor_sink::set_foreground_color_(std::uint16_t attribs) { } // change only the foreground bits (lowest 4 bits) - auto new_attribs = static_cast(attribs) | (orig_buffer_info.wAttributes & 0xfff0); + auto new_attribs = static_cast(attribs) | (orig_buffer_info.wAttributes & 0xff00); auto ignored = ::SetConsoleTextAttribute(static_cast(out_handle_), static_cast(new_attribs)); (void)(ignored);