Skip to content

Commit

Permalink
fixes windows console ouput colours
Browse files Browse the repository at this point in the history
  • Loading branch information
arozx committed Jan 28, 2025
1 parent 3b9341c commit d670ba8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Core/Utils/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ constexpr const char* Reset = "\033[0m";
constexpr const char* Yellow = "\033[33m";
constexpr const char* Red = "\033[31m";
constexpr const char* Purple = "\033[35m";

#ifdef _WIN32
// Enable ANSI support on Windows
inline void EnableColors() {
static bool enabled = false;
if (!enabled) {
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwMode = 0;
GetConsoleMode(hOut, &dwMode);
SetConsoleMode(hOut, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
enabled = true;
}
}
#endif
} // namespace LogColors

/**
Expand Down

0 comments on commit d670ba8

Please sign in to comment.