Color in C++

This is a discussion on Color in C++ within the C++ Programming forums, part of the General Programming Boards category; I want to add some basic colors into my C++ console program, just to give it some artistic value... or ...

  1. #1
    #include <me!> Flakster's Avatar
    Join Date
    May 2005
    Location
    Canada
    Posts
    50

    Color in C++

    I want to add some basic colors into my C++ console program, just to give it some artistic value... or something like that.

    What is the best way to go about this?

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Depends. On windows, you might check out ::SetConsoleTextAttribute(..), detailed on MSDN and in this FAQ entry: http://www.sunlightd.com/Windows/FAQ...leChangeColour and on linux, I think the curses library provides some color functions. Some odd escape sequences I guess can be print'ed, as detailed in this article: http://www.developer.com/open/article.php/631241 for linux.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    33
    if your wanting to run in a normal CMD window, use the system("color xx") function.

    to see the list of colors, open command prompt and type color ?/

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,642
    To continue the assumption that this is for windows - since the op hasn't specified:
    http://www.adrianxw.dk/SoftwareSite/...Consoles1.html

    gg

Popular pages Recent additions subscribe to a feed

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