Ordered dither matrices can limit color usage.

The 4th number is the number of colors to choose from.
Avoid C99 declarations.