Java Random Color getRandomColor()

Here you can find the source of getRandomColor()

Description

get Random Color

License

Open Source License

Declaration

public static String getRandomColor() 

Method Source Code

//package com.java2s;
//    it under the terms of the GNU General Public License as published by

import java.awt.Color;

public class Main {
    public static String getRandomColor() {

        String col = Integer.toHexString(new Color(
                (int) (Math.random() * 0xffffff)).darker().getRGB());
        while (col.length() < 6) {
            col = "0" + col;
        }//  w w  w  .  j  av  a 2 s  .  c om
        return col.substring(col.length() - 6);
    }
}

Related

  1. getRandomColor()
  2. getRandomColor()
  3. getRandomColor()
  4. getRandomColor()
  5. getRandomColor()
  6. getRandomColor()
  7. getRandomColor()
  8. getRandomColor()
  9. GetRandomColor()