To change text colour

This is a discussion on To change text colour within the C Programming forums, part of the General Programming Boards category; Hi, straightforward question, what is the command used in visual studio to change the appearance of text color. Basically, I ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    5

    Question To change text colour

    Hi, straightforward question, what is the command used in visual studio to change the appearance of text color. Basically, I am writing a simple program which will contain a number of options and when a particular option is chosen I want it to flash a different colour momentarily.
    Thanks,
    Dirty.

  2. #2
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    I've lost count of how many times this has been posted.
    You can save yourself time by using the search facility
    Code:
    the colors can be mixed 
    
    FOREGROUND_BLUE Text color contains blue. 
    FOREGROUND_GREEN Text color contains green. 
    FOREGROUND_RED Text color contains red. 
    FOREGROUND_INTENSITY Text color is intensified. 
    BACKGROUND_BLUE Background color contains blue. 
    BACKGROUND_GREEN Background color contains green. 
    BACKGROUND_RED Background color contains red. 
    BACKGROUND_INTENSITY Background color is intensified. 
    
    
    #include <windows.h>
    #include <stdio.h>
    
    int main( void )
    {
    
        HANDLE hStdout;
    
        hStdout = GetStdHandle(STD_OUTPUT_HANDLE); 
        SetConsoleTextAttribute(hStdout, FOREGROUND_RED);
        
        printf("WWWWOOOOO MY TEXT IS RED WWOOOOO!!");
    
        return 0;
    }
    All spelling mistakes, syntatical errors and stupid comments are intentional.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    5

    Cool tHANK YOU

    Thanks for the reply!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 01:23 AM
  2. text colour
    By Matty_Alan in forum C Programming
    Replies: 6
    Last Post: 06-27-2007, 06:56 AM
  3. chaning colour of text
    By 133t 50urc3 in forum C++ Programming
    Replies: 8
    Last Post: 06-26-2007, 06:30 AM
  4. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  5. adding a function to a program
    By trippedwire in forum C++ Programming
    Replies: 9
    Last Post: 09-30-2004, 01:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21