Thread: Color codes

  1. #1
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44

    Color codes

    When you are doing something like:
    SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE|BACKGROUND_RED);
    to set the background and foreground, what is the code for black?

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    If you want the foreground black, don't set any foreground colour.
    zen

  3. #3
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Bah, thats what I thought, and it works the first time I run through the function with the color code, but for some reason every other time I run it, the background seems to run to other parts of the screen for no reason.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Umm, SetConsoleTextAttribute(hStdout, FOREGROUND_BLACK); ??
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed