# VIDEO_PALETTE Control Video Colours

> Source: https://manual.pvxplus.com/directives/video-palette

## Formats

|  |  |  |
| --- | --- | --- |
| 1\. | [Read Palette](https://manual.pvxplus.com/directives/video-palette#Mark5)*:* | **VIDEO_PALETTE READ** *var$*\[,**ERR**=*stmtref*\] |
| 2\. | [Change Palette](https://manual.pvxplus.com/directives/video-palette#Mark7)*:* | **VIDEO_PALETTE** *string$*\[,**ERR**=*stmtref*\] |
| 3\. | [Read Palette Indexed Table](https://manual.pvxplus.com/directives/video-palette#Mark9)*:* | **VIDEO_PALETTE INDEXED READ** *var$*\[,**ERR**=*stmtref*\] |
| 4\. | [Change Palette Indexed Table](https://manual.pvxplus.com/directives/video-palette#Mark11)*:* | **VIDEO_PALETTE INDEXED** *string$*\[,**ERR**=*stmtref*\] |

***Where*:**

|  |  |
| --- | --- |
| *string$* | String expression containing the new **VIDEO_PALETTE** or **INDEXED** table settings to be used. |
| *stmtref* | Program line number or statement label to which to transfer control. |
| *var$* | String variable to receive the current **VIDEO_PALETTE** or **INDEXED** table settings. |

## Description

PxPlus supplies a 16-colour video palette with direct access to the standard 16 colours provided by Windows. Use the **VIDEO_PALETTE** directive to modify the 16-colour video palette in PxPlus.

## Format 1

***Read Palette***

**VIDEO_PALETTE READ** *var$*\[,**ERR**=*stmtref*\]

Use this format to read the current settings of the video palette. The video palette consists of a string of 16 3-byte entries, where each byte defines the intensity of the colours Red, Green and Blue.

***Example:***

The 3-byte entry for bright (foreground) green is $00FF00$, magenta is $FF00FF$, etc.

**VIDEO_PALETTE READ X$** will return the following defaults in a single string:

```
$000000 FF0000 00FF00 FFFF00$
$0000FF FF00FF 00FFFF FFFFFF$
$808080 800000 008000 808000$
$000080 800080 008080 C0C0C0$
```

The string is only punctuated by spaces to show you the 16 3-byte entries.

## Format 2

***Change Palette***

**VIDEO_PALETTE** *string$*\[,**ERR**=*stmtref*\]

Use this format to change/reset the video palette, as in **VIDEO_PALETTE** *X$* where *X$* contains your new values.

Note:  
Changing the palette may not work on all systems. This depends on the colour capabilities of the PC hardware.

## Format 3

***Read Palette Indexed Table***

**VIDEO_PALETTE INDEXED READ** *var$***\[,ERR**=*stmtref*\]

There is also an indexed table to reference the video palette. This index table consists of 48 entries: six 8-byte tables, where each byte represents an index into the video palette:

The ***first*** 8 bytes represent the standard foreground colours.

The ***second*** 8 bytes represent the colours used when the **'SB'** mnemonic is in effect.

The ***third*** 8 bytes represent the colours used when the **'BB'** mnemonic is in effect.

The ***fourth*** 8 bytes represent the colours used when both **'BB'** and **'SB'** are in effect.

The ***fifth*** 8 bytes represent the "Background" colours.

The ***sixth*** 8 bytes represent the colours used when **'BR'** and **'SB'** are in effect.

Use the **READ** format to return the current settings in the index table, as in **VIDEO_PALLETTE READ INDEXED** *X$*.

See ['BB'](https://manual.pvxplus.com/mnemonics/bb), ['BR'](https://manual.pvxplus.com/mnemonics/br) and ['SB'](https://manual.pvxplus.com/mnemonics/sb) mnemonics.

## Format 4

***Change Palette Indexed Table***

**VIDEO_PALETTE INDEXED** *string$*\[,**ERR**=*stmtref*\]

Use this format to change/reset the video palette index table, as in **VIDEO_PALLETTE INDEXED** *X$* where *X$* contains your new values.
