View Raw SPL
_colrlst(sysflag, empty)
{
        local i, s = "", p, nc, cfile;

        if (argc < 2)
        {
                if (argc < 1)
                {
                        sysflag = 0;
                }
                empty = 0;
        }

        nc = getnumcolors();

        cfile = (empty) ? "colors2.txt" : "colors.txt";

        /* first read color name list */
        s = strfile(_mh(cfile));

        if (strlen(s) != 0)
        {
                /* get number of colors */
                cnt = 1 + sum(charstrs(s) == charstr(strescape("\n")));
        }
        else
        {
                cnt = 0;
        }

        for (i = cnt; i <= nc; i++)
        {
                p = strcolor(i);

                if (strlen(p) > 0)
                {
                        if (sysflag || (strlen(strfind("SYS_", p)) == 0))
                        {
                                /* not a system color */
                                if (strlen(s) > 0) s = strcat(s, strescape("\n"));
                                s = strcat(s, p);
                        }
                }
        }
        return(s);
}