I'm creating a c program which colors some text using ANSI escape sequence arguments like printf("\e[38;2;r;g;bm");
in Ubuntu;
The problem is that the text get invisible if the background of the console matches with the foreground. If I print a text in black color in a white background it's perfectly visible but when the same code ran on a black background, the text is invisible.
So my plan is to get the terminal background color during runtime and choose text color accordingly.
Is there a way to get the background color of terminal in c?