I read an article that said generating random colors in JavaScript is easy, but generating pleasing random colors is more difficult. The article went on to present a long file of JavaScript that uses the HSV color model to choose colors with pleasing saturation and value in random hues.
I tried to implement a similar function using only RGB and simple heuristics to keep the colors in a pleasing color space. For example, it tries to keep each value of the hex triplet between #20 and #D0, so the colors won't end up too light or too dark. Darker colors are then shifted 1/3 of the way toward #00, and lighter colors are shifted 1/4 of the way toward #FF.
You can choose: