Here you can find the source of generatePallete(final int colours)
public static List<Color> generatePallete(final int colours)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Main { public static List<Color> generatePallete(final int colours) { final List<Color> pallete = new ArrayList<Color>(colours); for (int i = 0; i < colours; i++) { pallete.add(generateColour()); }//from w w w . ja v a2 s .co m return pallete; } /** * Generates a completely random, pastel colour. * @return */ public static Color generateColour() { final Random random = new Random(); int red = random.nextInt(256); int green = random.nextInt(256); int blue = random.nextInt(256); // mix the color red = (red + 255) / 2; green = (green + 255) / 2; blue = (blue + 255) / 2; final Color color = new Color(red, green, blue); return color; } }