Java Random Color makeRandomColor()

Here you can find the source of makeRandomColor()

Description

make Random Color

License

BSD License

Return

a totally random :) Color

Declaration

public static Color makeRandomColor() 

Method Source Code

//package com.java2s;
/**/*  ww  w  . j a  va 2s  .c o  m*/
 * <p>
 * Utilities for picking good colors, taken from various websites who claim to have good knowledge of colors
 * (such as Munsell or ColorBrewer).
 * </p>
 * <p>
 * <span class="BSDLicense"> This software is distributed under the <a
 * href="http://hci.stanford.edu/research/copyright.txt">BSD License</a>. </span>
 * </p>
 * 
 * @author <a href="http://graphics.stanford.edu/~ronyeh">Ron B Yeh</a> (ronyeh(AT)cs.stanford.edu)
 * @date Mar 17, 2004 Original Version
 * @date April 25, 2007 Cleaned Up and Included in R3
 */

import java.awt.Color;

public class Main {
    /**
     * @return a totally random :) Color
     */
    public static Color makeRandomColor() {
        int R = (int) Math.round(Math.random() * 255);
        int G = (int) Math.round(Math.random() * 255);
        int B = (int) Math.round(Math.random() * 255);
        return new Color(R, G, B);
    }
}

Related

  1. getRandomColour()
  2. getRandomHexColor()
  3. getRandomHexColor()
  4. getRandomIntColor()
  5. getRandomRgb()
  6. makeRandomColor()
  7. makeRandomColor(Color color)
  8. makeRandomColor(Color color, Color darkestColor, int maxAttempts)
  9. randomBrown()