# Difference between revisions of "Palette Functions"

• PALETTE FUNCTIONS **

``` set_color(int num, int rgb);
```

```     Set the specified color (0-511) to the given rgb-value.
```

``` set_color_rgb(int num, char r, char g, char b);
```

```     Set the specified color to the given rgb component
```
```     values. This function is easier to use than set_color(),
```
```     but it is slower.
```

``` get_color(int num);
```

```     Retrieve the rgb-value of the specified color.
```

``` load_palette(char pal_num, int *pal, char nb_pal);
```

```     Load one or more 16-color palette-blocks at once.
```
```     'pal_num' is the index of the first block (0-31)
```
```     to load, and 'nb_pal' the number of block.
```
```     This function can be used to load palette defined
```
```     using #defpal or included with #incpal directive.
```

``` set_sprpal(char pal_num, int *pal);
```
``` set_sprpal(char pal_num, int *pal, int nb_pal);
```

```     Exactly the same function has load_palette(),
```
```     but this function offers direct access to sprite
```
```     palette-blocks. Sprite palette-blocks are
```
```     standard block number 16 to 31, but with this function
```
```     you can simply access them with indexes 0 to 15.
```
```     This function and set_bgpal() function make sprite
```
```     and character palette-blocks manipulation easier;
```
```     with them you don't have to know the real block indexes.
```
```     Without the third arguments, the function loads
```
```     only one block.
```

``` set_bgpal(char pal_num, int *pal);
```
``` set_bgpal(char pal_num, int *pal, int nb_pal);
```

```     Same function as set_sprpal() but for character
```
```     palette-blocks.
```