Macaw OS C reference

Function nearestcolor

#include <macaw.h>
int nearestcolor(int r, int g, int b);

Finds which of the 256 colours is closest to a mix of red, green and blue, as they look now.

Parameters

rint
How much red, from 0 to 255.
gint
How much green, from 0 to 255.
bint
How much blue, from 0 to 255.

Returns int

The nearest colour number, from 0 to 255.

In Colours, with pal, palreset, drawpal, drawpalreset.