Thread: Coloring text

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    4

    Coloring text

    is there a way to display colored text in the screen

    and how to do it


    thank you,
    Last edited by thepolo; 05-24-2009 at 03:54 PM.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, in most systems it is possible.

    Unfortunately, there is no generic way to do this with Standard C. Various OS's and compilers have their solutions, and there are some generic libraries, such as ncurses or pdcurses that may do something like this - but that's a bit like buying a 211 piece toolkit, because you need a PZ1 screwdriver.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User Sharke's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    303
    Aw, it's not so hard in Windows anyway. Here's how to do it (go back and read the full tutorial too, it's good):

    Win32 Console Applications 4

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Sharke View Post
    Aw, it's not so hard in Windows anyway. Here's how to do it (go back and read the full tutorial too, it's good):

    Win32 Console Applications 4
    I didn't say it was hard. But since the original post doesn't even say if it's Windows, Linux, Solaris, VAX/VMS, a small company proprietary OS. So explaining how to do it in ONE OS, when there are possibly hundreds of others that it possibly could be (ok, so it's UNLIKELY that it is something other than Windows or Linux, but...)

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    If it's a Unix/Linux based platform then all you do is enable vt100 or compatible mode terminal emulation and pick the desired ANSI escape sequence, as in
    Code:
    printf("\033[37;41m"); /* change screen to foreground white and background red */

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    4

    Arrow

    I really appreciate all your help

    the os that i use is Ubuntu
    i think this article is quite useful

    So You Like Color

    thank you for all your done

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. 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
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM