CLEARPALETTE

Synopsis
CLEARPALETTE
Description

This command clears the color palette. The color palette is filled by using the SETPENCOLOR, SETSCREENCOLOR, and SETFLOODCOLOR commands. The palette is only supported when Windows is in 256 color mode (see Using Color). Once you run out of colors Windows will choose the closest match. For example, the instruction

REPEAT 256 [SETPENCOLOR (LIST REPCOUNT 0 0)]

fills the palette with 256 shades of red. At this point the palette cannot hold any more colors. If you wanted to draw green, they would end up being matched to red. In order for them to be drawn as green, you must "clear the palette" of the 256 shades of red.

If you want a wide range of colors then select a wide range into the palette. For example, the following would give you 216 colors covering a wide range. Once the few empty color slots in the palette are used, Windows will have something reasonable to match further requests to (unlike the example above in which only shades of reds could be matched to).

REPEAT 6 [
  MAKE "red REPCOUNT * 40
  REPEAT 6 [
    MAKE "green REPCOUNT * 40
    REPEAT 6 [
      MAKE "blue REPCOUNT * 40
      SETPENCOLOR (LIST :red :green :blue)
    ]
  ]
]

Note also that loading bitmap files with BITLOAD uses up colors in the palette. Again, this can be cleared using CLEARPALETTE.

Clearing the screen does not clear the palette, but it is a good time to do so.

Example
REPEAT 256 [SETPENCOLOR (LIST REPCOUNT 0 0)]
STATUS
CLEARPALETTE

SourceForge.net Logo