Thread: Text color

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    22

    Unhappy Text color

    I am using Dev-C++ to compile my source. I want to change my text color in dos text mode but I cannot use textcolor( ) with conio.h to do it because only Borland compilers can use that function. Is there another way to change my text color? Thanks.

  2. #2
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Do a search, this has been covered many times.

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Question I don't know how to decode this...

    Here's a line from an old DOS .BAT file that changes the text color. You would have to use system(PROMPT...)

    PROMPT $e[1;32;44m$p$g:$e[33m

    This works in a DOS window. I assume it will work in a Windows console program.

    You'll have to do some research and/or hacking to get the colors you want

    [EDIT]
    BTW - In case you're not aware, text color is not part of the ANSI C++ standard. If and how you can do it depends on your platform and compiler.
    Last edited by DougDbug; 06-20-2003 at 12:41 PM.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Thank's Salem

    Ahh, I was thinking about ANSI.SYS but didn't see it in my AUTOEXEC.BAT... I forgot that it was in CONFIG.SYS.

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    22
    Thanks for your help, appreciate it.

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I cover the text colour functions in my Console tut here.

    *** EDIT ***

    Oops, I mean here! Wrong page!
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GUI Text Color Problem
    By justlivelife15 in forum Windows Programming
    Replies: 3
    Last Post: 06-25-2007, 05:47 AM
  2. Change text color in C
    By IndioDoido in forum C Programming
    Replies: 9
    Last Post: 04-15-2007, 05:54 AM
  3. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  4. Color text from windows.h?
    By Saintdog in forum C++ Programming
    Replies: 10
    Last Post: 12-03-2004, 09:20 AM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM