Thread: Colors Help

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    22

    Colors Help

    remember im new at c++ but how can i add colors to my output???????????????????????????????????????????? ?????????????????????????????????????????????????? ????????????????????
    Laugh

  2. #2
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    What compiler..

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    22
    msvc++
    Laugh

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    70
    put this in your source file:

    void setcolour(unsigned short colour)
    {
    HANDLE HandleConsoleText = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(HandleConsoleText,colour);
    }

    Make sure it's outside the main function.

    to change the colour in console text, all you do now is, put this before the text:

    setcolout();

    inside the brackets you put a number, this is the colour, experiment with different numbers to get different colours
    e.g.

    setcolout(78);

    gives you yellow text on a red background.

    Go Microsoft Visual C++ (ROCK ON!) (i am also new to C++)

    I hope this helps, ciao.

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    70
    sorry i made a mistake, accidentally spelling something wrong,

    i put:

    setcolout();

    sorry i made a spelling mistake, you put:

    setcolour();

    ciao.

  7. #7
    Registered User
    Join Date
    Sep 2002
    Posts
    22
    where can i find a list of the color codes like 78 43 34 34 lol ????????????????????????
    Laugh

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why I only get 8 colors out of ncurses?
    By Nazgulled in forum C Programming
    Replies: 3
    Last Post: 05-08-2007, 06:06 PM
  2. Relation between material colors and light colors.
    By indigo0086 in forum Game Programming
    Replies: 3
    Last Post: 04-18-2007, 03:20 PM
  3. colors in forefox and colors in IE
    By MisterSako in forum Tech Board
    Replies: 3
    Last Post: 05-15-2006, 01:59 PM
  4. colors?
    By planet_abhi in forum Game Programming
    Replies: 1
    Last Post: 09-10-2003, 05:37 PM
  5. Text Colors
    By GaPe in forum C Programming
    Replies: 1
    Last Post: 07-11-2002, 06:57 AM