Is there a way to make windows output ansi escape sequences after internal console color changes? I know about things like ansicon that will INTERPRET ansi escape sequences output by a program being ran, but I am wondering if there is a way that windows will forward those escape sequences through stdout. For example
#include
#include
using namespace std;
HANDLE hCon;
enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };
void SetColor(Color c){
if(hCon == NULL)
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);
}
int main()
{
std::cout "\x1b[31;1m I should be red if printed on the console, otherwise I should have passed that ansi code to stdout.\n";
SetColor(GREEN);
cout "I should be green if printed on the console, but I should have passed the escape sequence to the stdout pipe..\n";
char x;
std::cin.get(x);
}
I want the byte level data being sent on stdout to be in ALL ansi approved text including color codes and cursor movement escaped sequences.. I'm not even sure that's possible but if any one knew... HERE would be the place to know if it's already been done. I am also open to possibilities on rolling my own and adding it to ansicon.