Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-05-2009
Member
 
Join Date: Apr 2009
Posts: 87
Change text color in Console

Hello,

I would like to know how to color the text displayed in the console?

Thank you for your help.
Reply With Quote
  #2  
Old 08-05-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Change text color in Console

In .Xresources you can specify colours for your term. Eg:

Code:
aterm*foreground: green
aterm*background: black

xterm*foreground: green
xterm*background: black

urxvt*foreground: green
urxvt*background: black
etc. man xterm or xterm --help for full options.

After changing the file you may need to do:

xrdb -merge ~/.Xresources
Reply With Quote
  #3  
Old 08-05-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Change text color in Console

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
Reply With Quote
  #4  
Old 08-05-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Change text color in Console

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
Reply With Quote
  #5  
Old 08-05-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Change text color in Console

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;
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Change text color in Console"
Thread Thread Starter Forum Replies Last Post
How to change title text color on Windows 8 Jason Voorhees Customize Desktop 4 24-09-2012 03:45 PM
How to change cell color in excel based on text input Chini mao Windows Software 2 06-01-2012 09:19 PM
Procedure to Change font text color in Windows 7 chyarte Windows Software 4 03-12-2010 06:45 AM
How to change text color using 'IF" in Excel Antrix Windows Software 2 26-06-2009 07:02 PM
How to Change CSS Text Color advsnhal Software Development 4 14-04-2009 02:50 PM


All times are GMT +5.5. The time now is 08:13 PM.