Developing a new library: error while creating javadoc and some general question

Very nice! It looks really good. Thanks so much for sharing this! Have you looked at other color libraries?

Minor suggestions:

  1. Add an explicit getPalleteCount() so that you can know how many are available.

  2. Drop the random “seed” println log line. If you do anything in a loop with this function it could spam the console and slow the sketch–and anyone who needs to know their random index can just create their own, then they know it, e.g.

int rindex = (int)random(getPalleteCount()-1);
int[] rpallete = getPallete(rindex);

Finally, this is a question of style, but I would personally suggest dropping the fail-to-random design for getPallete(i). Just have it fail. If someone doesn’t care what they get, they can use getPallete(). If they do care and use getPallete(i), they should get an error to debug – or that could optionally be handled with try. This also gets away from potentially printing tons of console warnings in a loop.

1 Like