Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>palette() - access 64 colors on ega and vga adaptors</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     palette() - access 64 colors on EGA and VGA adaptors
  Usage:    <color> = palette(<palette>, <color>)
  Params:   integer <palette> - the color that you are assigning
            the <color> to, in the range 0 - 15
            integer <color> - the color to assign to the palette
            defined by <palette> in the range 0 - 63.

  Returns:  an integer equal to the color defined to the palette
            specified.

            The way palette() works is as follows. Normally, you
            only have access to 16 colors on a color adaptor.
            However, the EGA and VGA can access many more colors.
            Using palette(), you can redefine any of the 16
            colors to display any of the 64 colors available on
            the EGA and VGA. What you do is pretend that the
            color values normally available ( 0 - 15 ) are simply
            palettes of color. 0 is the first palette, 1 is the
            second palette and so on. Each palette has 64 colors,
            1 of which can be displayed whenever that palette
            number is being displayed.

            Normally 0 is the color black, however, you can use
            the palette() function to redefine the color black
            to be any one of the 64 colors available on EGA and
            VGA adaptors. The extra colors available are numbers
            0 - 63 for a total of 64 colors. To assign a new
            color to the color black you would specify 0 as the
            first parameter (the palette), and then the new color
            as the second parameter. Then whenever the color 0
            (black) is displayed, the color defined as the second
            parameter will be used instead.

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

                 * define black palette (0) as DARK BLUE (8)
                 palette(0,8)

                 * set color to white on black
                 set color to W/N

                 @ 10,0 say "This prints White on Blue!"
                 * this line prints white on blue instead of
                 * white on black because the black 'palette'
                 * is set to blue instead.

                 palette(7,21)
                 * this sets the white palette (7) to be a
                 * pale violet (21)

                 * get the color assigned to palette 0 (black)
                 color = palette(0)

            Color Values are defined as follows. These colors are
            based on our observations, and may not necessarily
            reflect an exact interpretation of the color in question.
            It may however guide you quicker to the correct color.

  BLUES:    Color value    - Description
                 1         - Blue               * default for palette 1
                 8         - Deep dark blue
                 9         - very high intensity blue
                 11        - high intensity blue
                 13        - bluish-purple
                 17        - sky blue
                 24        - grayish-blue
                 25        - high intensity deep blue
                 33        - dim purple
                 41        - intense bright blue
                 57        - bright blue        * default for 9

  GREENS:   Color value    - Description
                 2         - green              * default for palette 2
                 10        - aqua green
                 16        - dim green
                 18        - high intensity green
                 19        - mid intensity green
                 22        - high intensity light green
                 23        - high intensity pale green
                 26        - bright green
                 34        - yellow green
                 42        - pale light green
                 48        - olive green
                 51        - blue-green
                 58        - bright green       * default for 10

  CYANS:    Color value    - Description
                 3         - cyan               * default for palette 3
                 27        - high intensity cyan
                 31        - light cyan
                 35        - light cyan
                 43        - high intensity cyan
                 49        - pale cyan
                 59        - bright cyan        * default for 11

  REDS:     Color value    - Description
                 4         - red                * default for palette 4
                 12        - deep rose color
                 32        - deep dark red
                 36        - intense red
                 44        - intense rose
                 52        - burnt orange
                 60        - bright red         * default for 12

  MAGENTAS: Color value    - Description
                 5         - magenta            * default for palette 5
                 15        - mid intensity purple
                 21        - pale violet
                 28        - pale wine color
                 29        - light blue-purple
                 37        - intense magenta
                 39        - bright pale wine
                 40        - deep purple
                 45        - bright purple
                 47        - pale purple
                 53        - dim magenta
                 61        - bright magenta     * default for 13

  YELLOWS:  Color value    - Description
                 6         - dim yellow
                 14        - very pale yellow
                 20        - brown              * default for 6
                 30        - light green-yellow
                 38        - intense brown
                 46        - pale reddish yellow
                 50        - high intensity yellow-green
                 54        - rich yellow
                 55        - pale yellow
                 62        - bright yellow      * default for 14

  GREYS:    Color value    - Description
                 0         - black              * default for palette 0
                 7         - white              * default for palette 7
                 56        - grey               * default for 8
                 63        - bright white       * default for 15

  Note:     Whenever you update a palette, if any characters on
            screen are using that palette, then a global color
            change will take place. The easiest way to use the
            palette() function is to set all your palettes at
            the beginning of your program. Set each palette to be
            a similar color. For example, Set the blue palette (1),
            to be a deep dark blue (8), and set the magenta palette
            (5) to be a pale magenta (28). Then just use the colors
            as normal using SET COLOR TO xx/xx/xx. That way, your
            programs will take advantage of the special colors on
            EGA and VGA adaptors, without compromising the colors
            on adaptors that don't support the additional colors.
            The palette() function only works on EGA and VGA
            adaptors. If your adaptor is not an EGA or VGA, the
            palette() function automatically senses it and ignores
            the function call. If you do a setmode(), FLreset(),
            __Vinit(), then the palette is cleared. Also note that
            If you load a font into the VGA, the first font you
            load also clears the palette since it switches the mode to
            the 8x14 character set (350 scan lines).

            You can compile the demo program COLORS.PRG to see
            all the colors available to you on an EGA adaptor.


See Also: setattr() standard() enhanced() unselected()

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