in reply to to generate a set of well contrasted colors

This might be of some help. It is a subroutine I wrote to generate randomly-colored backgrounds for text-on-colored-background pages. The two simple subroutines bg_text() and bg_page() at the bottom illustrate how to use it. I used this method to create the background colors for areas containing text (tables) and areas elsewhere (page background). Pick a contrasting color for the text, or experiment with a different brightness and saturation for randomly-colored text. Some experimentation will be required.
# Subroutine bg_color() creates colors of random hue and fairly # consistent brightness and saturation. The highest and lowest of the # three color channel values are fixed, and the third is given # a random value between the highest and lowest. The three values are # then assigned in random order to red, green, and blue. The highest # value will control the brightness of the resulting color, and the # distance between the highest and lowest will control the saturation. # Hue is randomly set by the value of the random third parameter toget +her # with the random assignment of the three values to red, green, and bl +ue. sub bg_color { my $highest = shift; # lightness my $lowest = shift; # saturation my $middle = int(rand($highest - $lowest) + $lowest); my @c = ($highest, $lowest, $middle); # randomize the order of the three values with the Fisher-Yates shuf +fle my ($i, $j); for ($i = 3; --$i; ) { $j = int rand ($i+1); next if $i == $j; @c[$i,$j] = @c[$j,$i]; } # convert to hex in the form: #RRGGBB my $cs = sprintf "\#%0.2X%0.2X%0.2X", @c; return $cs; } sub bg_text {bg_color(215, 153)}; # light colors, low saturation sub bg_page {bg_color(204, 102)};