Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FreshWin (c) Fresh Technologies - <b>vidpalette() color function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  VIDPALETTE()                                                Color Function
 Purpose..: Redefine colors on EGA and VGA adaptors
-------------------------------------------------------------------------------
 Syntax...: VidPalette( <nClrIn>, <nClrOut> ) --> nClrOut

 Arguments: <nClrIn>   = foreground or background color attribute
                        which is to be re-assigned. You can choose the
                        which one it is to be using values from 0 to 15.

            <nClrOut>  = foreground or background color attribute
                        to assign. You can choose which one it is to be
                        using values from 0 to 63.

       ForeGround/BackGround Examples with Codes and Attributes
      ----------------------------------------------------------
        BackGround    ForeGround     Color            Codes
      ----------------------------------------------------------
           Sample      Sample        Black            N    0
           Sample      Sample        Blue             B    1
           Sample      Sample        Green            G    2
           Sample      Sample        Cyan            BG    3
           Sample      Sample        Red              R    4
           Sample      Sample        Magenta         RB    5
           Sample      Sample        Brown           GR    6
           Sample      Sample        White            W    7

           Sample      Sample        Grey             N+   8
           Sample      Sample        Bright Blue      B+   9
           Sample      Sample        Bright Green     G+  10
           Sample      Sample        Bright Cyan     BG+  11
           Sample      Sample        Bright Red       R+  12
           Sample      Sample        Bright Magenta  RB+  13
           Sample      Sample        Yellow          GR+  14
           Sample      Sample        Bright White     W+  15
      ----------------------------------------------------------

 Returns..: <N> foreground or background color attribute which takes
            on a value from 0 to 63. The result is the same as the
            second parameter.

 Remark...: Usually, a color adaptor defines a palette of 16 colors.
            However, with EGA and VGA, you can display many more. Using
            VidPalette(), you can redefine any of the 16 colors to
            display any one of the 64 colors available via EGA and VGA.
            For those of you with UltraVision from Personics, you can see
            the colors using the 64COLORS.COM program in the package.

            To make the change, you pretend that the available color values
            ( 0 to 15 ) are themselves palettes of color. That is,
            0 is the first palette, 1 is the second and so on.
            Each of the palettes has 64 colors, one of which can be
            displayed whenever that number is used.

            Consider 0, the color black. You can use VidPalette()
            to redefine black to be any one of the 64 colors of the
            EGA and VGA color adaptors. The other colors are numbered
            0 - 63, 64 of them. To assign a new color to black,
            specify 0 as the first parameter, <nClrIn>, and the new color
            as <nClrOut>. Then whenever black is to be displayed, the
            newly defined color will be used instead.

 Source...: VIDPAL.C
-------------------------------------------------------------------------------
 Example..: The example uses the function to set up a
            color screen of different colors then reset it.

           VidPalette( 15, 39)    // change bright white to pale rose
           VidPalette(  0, 53)    // change black to hot pink

           setcolor( N+/*W )

           @ 10,0 say "This message will appear as hot pink on pale rose"

           VidPalette( 15, 63)    // change it back
           VidPalette(  0,  0)    // change it back

See Also: ClrTable() MkClrTable()

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