Hello,
I would like to know how to color the text displayed in the console?
Thank you for your help.
Printable View
Hello,
I would like to know how to color the text displayed in the console?
Thank you for your help.
In .Xresources you can specify colours for your term. Eg:
etc. man xterm or xterm --help for full options.Code:aterm*foreground: green
aterm*background: black
xterm*foreground: green
xterm*background: black
urxvt*foreground: green
urxvt*background: black
After changing the file you may need to do:
xrdb -merge ~/.Xresources
hi,
only for you or for all users of your program? right click at the top of your console and options, if not regrarde side of the library windows.h
this will change the text color in console
Code:/ / coloring function ->
void colo (WORD Attributes)
(
HANDLE GetStdHandle H = (STD_OUTPUT_HANDLE);
SetConsoleTextAttribute (H, Attributes);
)
/ / <- Coloring function
Code:#include <stdio.h>
#include <windows.h>
int main()
{
HANDLE hConsole;
int bb;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
for(bb = 0; bb < 254; bb++)
{
SetConsoleTextAttribute(hConsole, bb);
printf("%3d %s\n", bb, "it will display own color");
}
getchar();
return 0;