Results 1 to 5 of 5

Thread: Change text color in Console

  1. #1
    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.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    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

  4. #4
    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

  5. #5
    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;

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,171,383.47457 seconds with 17 queries