View Raw SPL
/* set a defined color using composite value or RGB */
setcolorval(coloridx, r, g, b)
{
        if (not(argc == 2) && not(argc == 4))
        {
                error(sprintf("%s - color index required and color value or 3 RGB values required", __FUNC__));
        }
        
        if (argc == 2)
        {
                (r, g, b) = int2rgb(r);
        }

        /* set color using RGB values */
        defcolor(r, g, b, coloridx);
}