---
name: "makecol8"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/makecol8"
---

# makecol8(3alleg)

Converts an RGB value into a display dependent pixel format. Allegro game programming library.

## NAME

makecol8, makecol15, makecol16, makecol24, makecol32 - Converts an RGB value into a display dependent pixel format. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**int makecol8(int r, int g, int b);**

**int makecol15(int r, int g, int b);**

**int makecol16(int r, int g, int b);**

**int makecol24(int r, int g, int b);**

**int makecol32(int r, int g, int b);**

## DESCRIPTION

These functions convert colors from a hardware independent form (red,  green, and blue values ranging 0-255) into various display dependent  pixel formats. Converting to 15, 16, 24, or 32-bit formats only takes a  few shifts, so it is fairly efficient. Converting to an 8-bit color  involves searching the palette to find the closest match, which is quite  slow unless you have set up an RGB mapping table (see below). Example:

```
   /* 16 bit color version of green. */
   int green_color = makecol16(0, 255, 0);
```

## RETURN VALUE

Returns the requested RGB triplet in the specified color depth.

## SEE ALSO

[**makeacol32**(3alleg)](/makeacol32/3alleg.md), [**makecol**(3alleg)](/makecol/3alleg.md), [**makecol\_depth**(3alleg)](/makecol_depth/3alleg.md), [**makecol15\_dither**(3alleg)](/makecol15_dither/3alleg.md), [**rgb\_map**(3alleg)](/rgb_map/3alleg.md), [**bestfit\_color**(3alleg)](/bestfit_color/3alleg.md), [**set\_color\_depth**(3alleg)](/set_color_depth/3alleg.md), [**exrgbhsv**(3alleg)](/exrgbhsv/3alleg.md)
