---
name: "CL_Palette"
section: "3"
platform: "linux"
package: "clanlib0-common-dev"
version: "0.4.4-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/CL_Palette"
---

# CL\_Palette(3)

Palette class.

## NAME

CL\_Palette - Palette class.

## DESCRIPTION

CL\_Palette represents a palette in the form of a 256 byte array.

Palettes are in ClanLib only used by surface providers. A provider specifies it's palette by returning a CL\_Palette. But It can also choose to return NULL. In that case it will use the system palette. You can change the system palette from CL\_Display or CL\_DisplayCard.

## CLASS MEMBERS

- unsigned char \***palette**

  - int **num\_colors**

  - **CL\_Palette**()

  - virtual **~CL\_Palette**()

  - **CL\_Palette**(

  ```
  unsigned char *palette,
  int num_colors=256)
  ```

- **CL\_Palette**(

  ```
  char *palette_id,
  CL_InputSourceProvider *provider)
  ```

- **CL\_Palette**(

  ```
  CL_InputSource *input)
  ```

## MEMBERS WITH DESCRIPTIONS

- unsigned char \***palette**

  ```
  Description:
  ```

  The actual palette. 1 byte for each color component (rgb), 256 colors. = new unsigned char\[num\_colors\*3\]

- int **num\_colors**

  ```
  Description:
  ```

  Number of colours in the palette.

- **CL\_Palette**()

  ```
  Description:
  ```

  Creates a palette.

- virtual **~CL\_Palette**()

  ```
  Description:
  ```

- **CL\_Palette**(

  ```
  unsigned char *palette,
  int num_colors=256)
  ```

  ```
  Parameters:
  palette - palette source.
  num_colors - number of palette colors.
  ```

  ```
  Description:
  ```

  Creates a palette using values from an unsigned char array.

- **CL\_Palette**(

  ```
  char *palette_id,
  CL_InputSourceProvider *provider)
  ```

  ```
  Parameters:
  palette_id - ID used to get palette from provider.
  provider - Input source type (eg. a datafile or a normal file).
  ```

  ```
  Description:
  ```

  Creates a palette from a input source.

- **CL\_Palette**(

  ```
  CL_InputSource *input)
  ```

  ```
  Parameters:
  input - Input source to read from.
  ```

  ```
  Description:
  ```

  Creates a palette from an already open input source.

## SEE ALSO

- **CL\_Display**

  The system palette is set here.

- **CL\_DisplayCard**

  The card specific system palette is set here.

- **CL\_SurfaceProvider**

  Palettelized surfaces use this class.

All ClanLib API classes can be found in **clanlib (3)**.

## AUTHORS

Originally written by Magnus Norddahl \<*mbn@dark.x.dtu.dk*\> and Martin Starch \<*starch@dark.x.dtu.dk*\>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at **http://somewhere.in.the.world.org**).

See **clanlib (3)** to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.
