Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>textbackground() set the background color</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 textbackground()        Set the Background Color

 #include   <conio.h>

 void       textbackground(color);
 int        color;

    textbackground() sets the background text color.  The only text
    affected by a call to textbackground() is that which is displayed
    using direct console output functions after textbackground() is
    called.  'color' is an integer value from 0 to 7.

    (Color information is represented by an 8-bit value: the four lowest
    bits represent the foreground color (0-15).  The next three bits
    represent the background color(0-7).  The high bit is the blink-
    enable bit. If this bit is on, the character will blink. The symbolic
    constant BLINK is defined in <conio.h> and can be added to the
    foreground and/or background color(s) to make the character blink.
    Use textattr() to set the foreground and background colors in one
    call, and textcolor() to set the foreground color only.)

    The allowable colors, their symbolic constants and corresponding
    values are defined in <conio.h> :

    Symbolic constant    Value     Foreground &/or Background
     BLACK                 0            Both
     BLUE             1            Both
     GREEN                 2            Both
     CYAN             3            Both
     RED                   4            Both
     MAGENTA               5       Both
     BROWN                 6            Both
     LIGHTGRAY        7            Both
     DARKGRAY         8            Foreground
     LIGHTBLUE        9            Foreground
     LIGHTGREEN           10            Foreground
     LIGHTCYAN       11            Foreground
     LIGHTRED        12            Foreground
     LIGHTMAGENTA    13            Foreground
     YELLOW               14            Foreground
     WHITE                15            Foreground
     BLINK               128            Foreground


    Note that because the background color is set using only 3 bits, only
    the first eight colors can be used.


       Returns:     Nothing.

   Portability:     IBM PC and BIOS compatibles only.

 ------------------------------ Example ---------------------------------

    The following statements print a blinking message in yellow text on a
    green background.

           #include <conio.h>

           main()
           {
               textcolor(YELLOW + BLINK);
               textbackground(GREEN);
               cputs("YOU'LL SEE BLINKING YELLOW TEXT ON A GREEN
                      BACKGROUND.");
           }


See Also: textattr() textcolor()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson