Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Basic - <b>color set foreground, background, and border colors</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
COLOR                    Set Foreground, Background, and Border Colors

 COLOR [foreground] [,[background] [,border]]     ' Screen mode 0
 COLOR [background] [,[palette]                   ' Screen mode 1
 COLOR [foreground] [,[background]]               ' Screen modes 7-10

    In text mode (Screen mode 0), specifies foreground, background, and
    border colors. In medium-resolution graphics mode (Screen mode 1),
    specifies palette and background color. In Screen modes 7 through 10,
    specifies foreground and background colors. May not be used in Screen
    mode 2 (high-resolution graphics).

  foreground    An integer expression; selects the foreground color. For
                Screen mode 0, this value must be in the range 0 to 31;
                for Screen modes 7 to 10, this value must be in the range
                1 to 15.

  background    An integer expression; selects the background color. For
                Screen mode 0, this value must be in the range 0 to 7; for
                Screen modes 1 through 10, this value must be in the range
                0 to 63.

     palette    An integer expression, selecting one of two color palettes
                (see below).

      border    An integer expression; must be in the range 0 to 15.
                Selects the color of the border.

                         Color values

          Value     Color          Value     Color
            0       Black            8       Gray
            1       Blue             9       Light blue
            2       Green           10       Light green
            3       Cyan            11       Light cyan
            4       Red             12       Light red
            5       Magenta         13       Light magenta
            6       Brown           14       Yellow
            7       White           15       Bright white

          Add 16 to a value to produce its blinking equivalent.

                    Foreground Attributes for the
                     Monochrome Display Adapter

                        Value      Foreground Attribute
                         0         Black
                         1         Underlined
                         2-7       White
                         8         Black
                         9         Underlined high intensity
                         10-15     High-intensity white
                         16        Black
                         17        Underlined black
                         18-23     Blink
                         24        Black
                         25        Blinking underlined high intensity
                         26-31     Blinking high intensity

          Background values in the range 0 to 6 produce a black background;
          a value of 7 produces a white background.

          If background and foreground are the same, the characters
          will be invisible.

          The following is a list of legal values for each Screen mode:

               SCREEN 0 (text mode)
                    The foreground color must be in the range 0 to 31.
                    The background color must be in the range 0 to 7.
                    The border color must be in the range 0 to 15.

                    The default color for background and border is black.

               SCREEN 1 (medium-resolution graphics mode)
                    The background color must be in the range 0 to 15.
                    Even numbers for palette select Palette 0; odd
                         numbers select Palette 1.

                                   Palettes

                    Color     Palette 0                Palette 1
                    0         Current background       Current background
                    1         Green                    Cyan
                    2         Red                      Magenta
                    3         Brown                    White

               SCREEN 2 (High-resolution graphics mode)
                    Calling COLOR in this mode results in a runtime error

               SCREEN 7 and 8
                    The foreground color must be in the range 1 to 15.
                    The background color must be in the range 0 to 15.

                    EGA only. The colors are dependent on the current
                    palette selected (See PALETTE statement).

               SCREEN 9
                    The foreground color must be in the range 1 to 15 for
                    EGAs with more than 64K. For EGAs with only 64K,
                    the foreground color must be in the range 1 to 3.

                    The background color must be in the range 0 to 63.

                    EGA only. The colors are dependent on the current
                    palette selected (See PALETTE statement).

               SCREEN 10
                    The foreground color must be in the range 1 to 3. The
                    values are as follows: 1 = Black; 2 = Blink; and
                    3 = High Intensity.

                    The background color must be in the range 0 to 8.

                    EGA only. The colors are dependent on the current
                    palette selected (See PALETTE statement).

   --------------------------------------------------------------------------

      Notes:    In text mode (Screen mode 0), the COLOR statement
                specifies the foreground, background, and border colors.
                Omitted parameters retain former values. The default is
                white foreground (7), black background (0), and black
                border (0). The border parameter is ignored on the
                Monochrome Display Adapter.

                In medium-resolution graphics mode (Screen mode 1), the
                COLOR statement doesn't actually specify the foreground
                color. Instead it specifies the background color and one
                of two three-color palettes. Foreground colors are
                selected from the current palette via the PSET, PRESET,
                LINE, CIRCLE, PAINT, VIEW, and DRAW statements. Either the
                background parameter or the palette parameter (but not
                both) may be omitted; omitted parameters retain former
                values.

                The COLOR statement may not be used in high-resolution
                graphics mode (Screen mode 2).

                The border option cannot be used with an Enhanced Graphics
                Adapter (EGA) with an Enhanced Color Display.

See Also: PALETTE SCREEN Color Chart

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