mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
20 lines
442 B
C++
20 lines
442 B
C++
#include <LX-Common.h>
|
|
|
|
namespace LX
|
|
{
|
|
void PrintStringAsColor(const std::string& str, Color c)
|
|
{
|
|
// Gets a handle to the console //
|
|
static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
// Sets the color of the console to the desired color //
|
|
SetConsoleTextAttribute(hConsole, (WORD)c);
|
|
|
|
// Outputs the text //
|
|
std::cout << str;
|
|
|
|
// Resets the color //
|
|
SetConsoleTextAttribute(hConsole, (WORD)Color::LIGHT_GRAY);
|
|
}
|
|
}
|